> For the complete documentation index, see [llms.txt](https://docs.graspil.com/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graspil.com/en/cases/case-yandex-metrika.md).

# Case: sending conversions to Yandex Metrika

This guide walks through the whole path — from connecting a bot/channel to automatically sending data to Yandex Metrika — without writing a single line of code.

{% hint style="info" %}
**What you'll end up with:** a user clicks your ad link → lands in your bot or channel → performs the action you care about (joins, starts the bot, pays, etc.) → graspil automatically reports this to Yandex Metrika as an offline conversion. You immediately see in Metrika which ads bring real users, not just clicks.
{% endhint %}

{% hint style="info" %}
The AI assistant built into graspil is trained to help with exactly this scenario. If anything is unclear along the way, open the assistant chat in your dashboard and ask it to help you set up sending postbacks to Yandex Metrika — it will guide you through the specific steps for your situation.
{% endhint %}

***

## Step 1. Connect a bot or channel

For graspil to see what your users do, you first need to connect a resource — a bot or a Telegram channel.

* Detailed guide on connecting a bot — [“Bot connection”](https://github.com/graspil/docs_en/blob/main/README%20\(1\).md). There are three ways: auto-setup with a token, proxying, or connecting via API — pick whichever is convenient.
* Detailed guide on connecting a channel — [“Connecting channels”](/en/connecting-channels.md).

{% hint style="info" %}
You can connect both a bot and a channel at the same time — for example, to track the whole chain “joined the channel → started the bot.”
{% endhint %}

## Step 2. Set up a tlin landing page

A tlin.cc landing is a short link you put in your ads instead of a direct link to the bot/channel. It carries UTM tags from your ad and — important for this case — passes the Yandex Metrika client identifier (`ym_uid`) to the server, which is later needed to send a conversion for that exact user.

Full guide on creating and configuring a landing — [“Landings (tlin.cc redirect)”](/en/app/landings.md). In short, here's what to do:

1. Create a landing for the bot/channel you want to drive traffic to.
2. In the landing's “Analytics and scripts” settings, specify the **Yandex Metrika ID** — the counter installed on your ad landing/site (or simply the counter you want conversions to appear in).
3. Use the link to this landing (`tlin.cc/your-alias`) in your ads instead of a direct link to the bot/channel.

{% hint style="warning" %}
A landing is required here. Without it the user won't have a client identifier (`client_id`/`yclid`), and Metrika won't be able to tie the conversion to a specific ad click — there will be nothing to send the data against. Landings are a paid feature.
{% endhint %}

## Step 3. Connect the Yandex Metrika integration

1. Go to the **“Integrations”** section in your dashboard.
2. Find the **Yandex Metrika** card in the list of available integrations and click **“Configure.”**
3. Click **“Connect”** — an authorization button will appear.
4. Click **“Connect”** again — you'll be redirected to Yandex's authorization page. Sign in with the Yandex account that owns the Metrika counter you need, and grant access.
5. After being redirected back to graspil, enter the **Counter ID** (the number you can find in your counter's settings on `metrika.yandex.ru`) and click **“Save settings.”**

{% hint style="warning" %}
**Important:** the Metrika counter itself must have offline conversion uploads enabled, and the target/goal you'll be sending data to must already exist in the counter's settings. You'll need that target's name/identifier in the next step.
{% endhint %}

## Step 4. Create an automation

Now set up the actual scenario: “when this event happens — send the data to Yandex Metrika.” This is done in the **“Automations”** section ([full documentation](/en/app/automations.md)).

### Fast way — catalog of ready-made automations

In **“Automations”** → **“Create automation”**, open the **catalog of ready-made automations** and pick the **“Send conversion to Yandex Metrika”** template. The template already has the trigger and the action configured — just pick the bot/channel, the trigger event you need, and your integration from Step 3, then publish the automation.

### Manual way — build the scheme yourself

If you'd rather build the scheme from scratch or need a non-standard setup:

1. Open **“Automations”** → **“Create automation”**, and select the bot/channel.
2. Open the builder and add an **“By event”** trigger. For this use case, the natural default choices are:

   * `new_user` — the user started the bot, or
   * `user_chat_new` — the user joined the channel.

   But you can pick **any other event** — a payment (`successful_payment`), opening a mini app, clicking a button, or your own custom event. See the full list in the [“Event reference”](/en/app/reports/events.md).
3. Add an **“Integrations”** action block, choose the **“Yandex Metrika”** type, and fill in:
   * **Integration** — the one you connected in Step 3.
   * **ID type** — `client_id` (if you're using a tlin landing), `yclid` (Yandex Direct ad click), or `user_id` (your own identifier).
   * **ID path** — a variable that holds the value, e.g. `{{ user.ym_client_id }}`.
   * **Target** — the name of the goal/target you created in the counter in Step 3.
   * Optionally, you can also pass the conversion amount, currency, and date/time — useful if these matter for your Metrika reports.
4. Connect the trigger and the action with an arrow, click **“Run test”** to check the scheme, then publish the automation.

From this point on, every time the chosen event happens, the data is automatically sent to Yandex Metrika — with no further action from you.

***

## Any event, and end-to-end analytics

By default, the simplest setup is to send data on joining a channel or starting a bot — that covers the basic “ad → subscription” case. But you can choose literally any event as the trigger — a payment, a form submission, any custom event from your own system.

You can also build an **end-to-end chain** of several steps, for example:

> Joined the channel → started the bot → made a purchase (conversion) → sent the data to Yandex Metrika

This uses the **“Condition”** and **“Wait for event”** blocks inside a single automation (for instance, waiting for a payment after the bot start, with a timeout) — see the [“Automations”](/en/app/automations.md) section for details. That way Metrika only receives a conversion once the user has gone through the entire chain, not just on the first step.

***

## Need help setting this up?

If something isn't working or you still have questions, contact graspil support — we'll help you set up sending conversions to Yandex Metrika for your specific case.
