How to connect Yandex Metrica + Yandex Webmaster with AI in 2026
Next step
Open the bot or continue inside this section.
Article -> plan in AI
Paste this article URL into any AI and get an implementation plan for your project.
Read this article: https://vibecode.morecil.ru/en/seo/kak-podklychit-yandex-metriky-i-webmaster/
Work in my current project context.
Create an implementation plan for this stack:
1) what to change
2) which files to edit
3) risks and typical mistakes
4) how to verify everything works
If there are options, provide "quick" and "production-ready". How to use
- Copy this prompt and send it to your AI chat.
- Attach your project or open the repository folder in the AI tool.
- Ask for file-level changes, risks, and a quick verification checklist.
In this article, we will configure all Yandex analytics on any site. The metric will show who comes, what clicks and where falls off. The webmaster will accelerate indexing in Yandex and show errors.
Why do we need it in 2026
- Yandex still accounts for 30-60% of traffic to Russian-language projects.
- Metric + Webmaster = automatic “bypassing the counters” → pages are indexed 2-3 times faster.
- You immediately see real conversions in Telegram bots, Mini Apps and Next.js apps.
What you need (5 minutes of preparation)
- Yandex account (or create a new one).
- Access to the site code (GitHub + Vercel/Netlify or hosting).
- AI (Claude 3.5/4, Gemini 2.5 Pro or Cursor).
Step 1. Create a counter Yandex Metrics (manual, 2 minutes)
- Go to https://metrika.yandex.ru/
- Press "Create a counter.".
- Enter the name (for example, "VibeCode Wiki").
- Give me the address
- Turn it on
- Webvisor
- Click map
- External link tracking
- Exact bounce rate
- Save → copy the number of the counter (8-9 digits, for example 98765432).
Done.
Step 2. We add the site to Yandex Webmaster + confirm the rights (with a prompt)
- Go to https://webmaster.yandex.ru/
- Click “Add Site” → Enter your website address
- Select the confirmation method ** "Metague on the main page"**
Yandex will issue a line of form:
<meta name="yandex-verification" content="[Unique Number]" />
Prompt for AI:
Add the Yandex Webmaster meta tag to <head> on all pages.
Meta tag:
<meta name="yandex-verification" content="[Unique Number]" />
File: app/layout.tsx (or globals.css if you use metadata)
Make sure that the meta tag is always there, even with SSR.
Show me the code.
Insert the resulting code in app/layout.tsx:
export const metadata = {
other: {
'yandex-verification': '[Уникальный номер]',
},
}
Or manually in <head> via <Script>, the AI will tell you.
After inserting, go back to the Webmaster → “Confirm”. Ready in 30 seconds.
Step 3. Install the Metrics code on Next.js (App Router)
Add Yandex Metric (id: [your counter ID]) to the entire site.
Requirements:
Download only on the client (use client)
- Don't break the SSR.
- Work with next/navigation
- Track page view automatically
- Add typing.
Give the full component + how to connect to layout.tsx
The AI will give the finished YandexMetrika.tsx component. An example of what usually happens:
'use client';
import { useEffect } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
export default function YandexMetrika() {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
const ym = (window as any).ym;
if (typeof ym === 'function') {
ym(98765432, 'hit', window.location.href);
}
}, [pathname, searchParams]);
return null;
}
Connect to app/layout.tsx:
import YandexMetrika from '@/components/YandexMetrika';
export default function RootLayout({ children }) {
return (
<html lang="ru">
<body>
{children}
<YandexMetrika />
</body>
</html>
);
}
Step 4. We link Metrica and Webmaster (so that Yandex indexes faster)
- In Metric → Settings → Counter → “Tie to the Webmaster”.
- In Webmaster → Settings → “Based to Yandex Metric” → confirm the request.
- In the Webmaster → Indexing → Bypass on meters → turn on.
Done. Now the Yandex robot is running your site as if it were on schedule.
Step 5. Set the targets:
Prompt for AI:
Create 5 ready-made goals for Yandex Metrics in JavaScript format:
1. Click on the "Start Free" button
2. View the page /thank-you
3. Sending the form (id form contact)
4. Addition to Telegram bot
5. Purchase (amount > 0)
For Next.js + App Router. Show me the code for ym('reachGoal')
Example of the “Click on the button” goal:
document.querySelector('#start-free').addEventListener('click', () => {
ym(98765432, 'reachGoal', 'start_free');
});
Check in 2 minutes
- Open the site → click F12 → Network tab → filter “metrika”.
- You must request
https://mc.yandex.ru/... - In Metrica in 5-10 minutes will be the first visits.
- In the Webmaster, check the Diagnostics - there should be no mistakes.
Wibe encoder bonuses
- You want a target without a code? Use Playwright Skill – AI clicks and creates goals.
- For Telegram Mini Apps, add
ym(XXXX, 'init', { ... })inside WebApp. - If you want a machine, make GitHub Action, which checks for a meta tag.
Okay. Now you have a full-fledged Yandex analytics.