Skip to content
MGRAMGuides

UTM tracking for a Telegram bot: a funnel from click to payment

October 24, 20267 min readMGRAM team

UTM tags work fine on a website but never reach a Telegram bot: from a t.me link the bot gets only the start parameter. That is why bot ads are often judged by gut feeling. Here is how to tie an ad click to a bot start, a sign-up and a payment, and see which source pays off.

In short. From a link, Telegram passes your bot only the start parameter — up to 64 characters, no UTM tags. To know where every user came from, send ad traffic through an MGRAM UTM short link: on click it records the source and puts the click number {click_id} into the bot's address. The bot reports steps — start, sign-up, payment — with that number, and the panel builds the funnel and revenue for every link.

Why UTM tags don't work in a Telegram bot

On a website, analytics reads UTM tags from the address. A bot can't: from https://t.me/your_bot?start=oct_mailing it receives only the command /start oct_mailing, and Telegram drops everything else. The start parameter holds up to 64 characters: Latin letters, digits, _ and -.

You can put the source straight into the start parameter, but then everything else is on you: storing the tag per user, counting clicks, separating repeat starts, matching sign-ups and payments to sources. And you never learn how many people clicked the link but didn't start the bot.

How an MGRAM UTM funnel works

PartWhat it is
ProjectWhere traffic goes — a bot, a website or a Mini App — and the steps after the click, for example «start → sign-up → payment»
LinkA short address like https://utm.mgram.biz/abc1234 with its own UTM tags — one per traffic source
ClickMGRAM records the click, fills the placeholders in the address and sends the person on
StepYour bot, website or server reports what the person did, with the click number — the step is credited to the link and its tags

The link's UTM tags are stored by MGRAM, so you don't squeeze them into the start parameter: only the click number goes there.

Placeholders in the address

Placeholders go in curly braces right in the project's address and are filled on every click.

PlaceholderWhat it becomes
{click_id}The click number — pass it down the funnel: into the bot's /start or the website address
{utm_source} … {utm_term}The link's UTM tags
{sub1} … {sub5}Values from the click address, for example …/abc1234?sub1=vk
{project}, {link}The project number and the link code
{country}The visitor's country
{ts}Click time, Unix format

Ready-made addresses:

  • bot — https://t.me/your_bot?start={click_id};
  • Mini App — https://t.me/your_bot/app?startapp={click_id};
  • website — https://your-site.com/?mgram_cid={click_id}. The link's UTM tags are added to a website address automatically if it has none.

How to set up a funnel

  1. Open the panel app.mgram.biz → «Реклама» → «UTM-воронки» (Ads → UTM funnels) and click «Новый проект» (New project). The panel is in Russian for now.
  2. Pick a template: Telegram bot (steps start → sign-up → payment), website (visit → lead → purchase), Mini App (open → target action) or your own.
  3. Check the address with {click_id}, set a name and the UTM tags of the first link.
  4. Save the write key: it is shown once. Keep it in the server's environment variables, for example MGRAM_UTM_KEY.
  5. Create a link for every source: a broadcast, Reply Ads, your channel, a blogger.
  6. Copy the step-sending code from the «Интеграция» (Integration) tab into your bot or website.

Clicks are counted right away, with no code. Code is needed for the steps after the click.

How the bot reports steps

A step is a POST request to https://utm.mgram.biz/api/v1/events with the write key in the header Authorization: Bearer utm_sk_…. The panel has ready code for Python, aiogram, JavaScript, PHP, cURL and websites.

FieldWhy
stepThe step key: start, register, pay. A new key is added to the funnel automatically
click_idThe click number — ties the step to the link and its source
linkThe link code when there was no click, for example the bot was opened by its own link
user_idYour user ID
value, currencyThe step's amount and currency — the panel sums revenue per link from them
event_idYour event number: sending it again won't double the step
uniquetrue — the step counts once per click or user

In a bot it looks like this:

  1. A person taps the ad link and starts the bot — the bot gets /start <click number>.
  2. In the /start handler the bot sends the start step with that number and saves the number for the user.
  3. After sign-up the bot sends register with the same number, after payment — pay with the amount.

Example request body: {"step": "register", "click_id": "…", "user_id": "42", "unique": true}. Events can be sent in batches of up to 100 per request.

On a website, add the script https://utm.mgram.biz/t.js with the project's public key: from the browser only steps marked «site» in the project are counted. Never put the write key into page code — it is for servers and bots only.

  • Broadcasts and Reply Ads. Put the link into the post's button. To compare the services, make a copy of the post for each — with its own link.
  • Bot launches. At the «link» step of a launches order, send the address with the link code: https://t.me/your_bot?start=<link code>. The bot passes this code as click_id in its steps — they are credited to that link, and so to that order.
  • AI assistant. With MGRAM in ChatGPT and Claude the assistant creates the project, links and post copies itself and later shows clicks and funnel steps for every order.

What the stats show

  • Overview: clicks, unique visitors, the funnel — how many people reached each step and the conversion between steps, a daily chart, sources.
  • Links: numbers for every link, to compare sources and orders.
  • Activity: a feed of clicks and steps, newest first.

Clicks from link-preview bots — Telegram, VK, Facebook and others — are counted separately and don't skew the stats. MGRAM does not store IP addresses: unique visitors are counted by a daily anonymised fingerprint.

How to compare sources

MetricHow to calculate
Cost per clickSpend on the source ÷ clicks on its link
Cost per startSpend ÷ start steps
Cost per sign-upSpend ÷ register steps
Cost per paymentSpend ÷ pay steps
Return on ad spend (ROAS)Sum of pay steps ÷ spend

A cheap click is not a cheap customer: decide by cost per payment and return on ad spend.

Common mistakes

  • The bot didn't save the click number. The start step arrives, but sign-ups and payments come without click_id, and the source is lost. Save the number for the user right at /start.
  • One link for all sources. Then the funnel is shared and there is nothing to compare — create a link per placement.
  • The write key in the browser. Anyone can take it from the page code. On a website use only the public key and «site» steps.
  • Duplicate payments. Pass event_id: resending the same event won't double the revenue.

Limits

Up to 50 projects, up to 500 links per project, up to 20 funnel steps, up to 1,200 events per minute and 100 per request. Full API reference (in Russian) — MGRAM UTM docs.

FAQ

Can I pass UTM tags to a Telegram bot?

Not directly: from a t.me link the bot gets only a start parameter of up to 64 characters. With MGRAM UTM the tags stay with the short link, and the start parameter carries the click number {click_id}, which ties the bot's steps to the source.

How do I track Telegram bot conversions to payment?

Send traffic through an MGRAM UTM link with the address https://t.me/your_bot?start={click_id}. On start the bot saves the click number and reports the start, register and pay steps — the panel shows the funnel and revenue for each link.

Do I need to code?

Clicks are counted with no code. Steps after the click take a few lines in your bot or website — ready code for Python, aiogram, JavaScript, PHP and cURL is in the panel's Integration tab.

Does it work for websites and Mini Apps?

Yes. For a website use an address with {click_id} and the t.js script; for a Mini App, a link with startapp={click_id}. The panel has website and Mini App templates with ready steps.

How much do MGRAM UTM funnels cost?

There is no separate fee right now: UTM funnels are part of the app.mgram.biz panel. You pay only for the ads you order.

Can I compare MGRAM orders by payments?

Yes. Give every order its own link — in the post's button or in the start parameter of a launches order. Then the steps and revenue of that link are the result of that order.