> 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-google-analytics.md).

# Case: sending conversions to Google Analytics (GA4)

This guide walks through the whole path — from connecting a bot/channel to automatically sending data to Google Analytics 4 — 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 GA4 via the Measurement Protocol as a conversion event. You immediately see in Google Analytics which ads bring real users, not just clicks.
{% endhint %}

{% hint style="info" %}
If anything is unclear along the way, open the AI assistant chat in your dashboard and describe what you're trying to do in your own words — 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”](/en/connect-bot.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 GA4 client identifier (`ga_uid`, the value of the `_ga` cookie) 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 **Google Analytics ID** — the Measurement ID of your GA4 data stream, in the `G-XXXXXXX` format.
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, and specifically the intermediate page must be enabled (not an instant redirect) — only there does tlin have time to load `gtag.js` and capture the `_ga` client identifier before redirecting to Telegram. Landings are a paid feature.
{% endhint %}

## Step 3. Route the client identifier into a user field

The `ga_uid` identifier arrives in the bot deeplink's start parameter together with the rest of the UTM tags. To reference it as a variable in automations, the simplest approach is to map it into a user custom field once:

1. Open the bot page → **“UTM tags”** section (start parameter processing rules) — see [“Configuring start parameter processing”](/en/app/start-utm.md) for details. Note that parameter mapping only works in the mode where the start string is parsed into parameters, not in simplified mode.
2. Create a custom user field beforehand (e.g. `ga_client_id`) in the [“Custom fields”](/en/app/custom-fields.md) section, if it doesn't exist yet.
3. In the **“Parameters to custom fields”** block, add a route: parameter `ga_uid` → field `ga_client_id`.

After that, the identifier is available in automation templates as `{{ user.addition_fields.ga_client_id }}`.

## Step 4. Connect the Google Analytics integration

1. Go to the **“Integrations”** section in your dashboard.
2. Find the **Google Analytics (GA4)** card in the list of available integrations and click **“Configure.”**
3. Click **“Connect via Google”** — you'll be redirected to Google's authorization page. Sign in with the account that owns the GA4 property you need, and grant access.
4. Back in graspil, select the **GA4 property**, then the **data stream** — the web stream you want conversions to land in.
5. Click **“Save.”** graspil creates (or reuses) a Measurement Protocol secret for the chosen stream on its own — you don't need to enter one manually.

{% hint style="warning" %}
For these events to affect Google Ads bidding, link the GA4 property to a Google Ads account inside Google Analytics itself: **Admin → Product links → Google Ads**. graspil doesn't do this for you — it's a one-time setup inside Google Analytics.
{% endhint %}

## Step 5. Create an automation

There's no ready-made template for Google Analytics in the automation catalog yet — you'll need to build the scheme manually. This is done in the **“Automations”** section ([full documentation](/en/app/automations.md)).

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 **“Google Analytics (GA4)”** type, and fill in:
   * **Integration** — the one you connected in Step 4.
   * **Event name** — the GA4 event name, e.g. `purchase` or `sign_up`. Can be a constant or a template.
   * **Client identifier (client\_id) source field** — the path to the field from Step 3, e.g. `{{ user.addition_fields.ga_client_id }}`.
   * **Ignore missing client\_id** — when enabled, if the identifier is empty (e.g. for an organic user who never went through a landing), the step is simply skipped without an error.
   * Optionally, you can also send the conversion **value**, currency, and arbitrary event parameters as JSON — useful for reports inside GA4.
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 Google Analytics — 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 Google Analytics with the payment's amount and currency

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 GA4 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 Google Analytics for your specific case.
