Black Friday: −50% on everything until November 30

← Back

UTM Tracking in a Telegram Bot: How to See Where Clients Come From

Published on:

UTM Tracking in a Telegram Bot: How to See Where Clients Come From

Telegram does not pass ordinary UTM tags to a bot: a person taps a link, opens the bot, and without extra work you do not know where they came from. For a small business that means money goes into ads, posts and partners, and it is unclear which channel brings clients. Below I explain how this is solved, using my own case.

Why you cannot just add UTM tags in Telegram

On a website the tag lives in the page address and analytics reads it on its own. A bot has a single address, the link to the bot. Whatever you want to pass along, Telegram hands to the bot in one form only: the parameter of the /start command. That is a deep link.

So the scheme is:

  • for each source (ad, post, partner, QR code) you make a separate link with a unique parameter;
  • on start the bot reads the parameter and stores it with the user;
  • every later action of that person is tied to the source.

What I built in the case

In the UTM tracking case the goal was bigger than collecting leads. The system had to show where a user came from, how they moved through the funnel and which campaigns actually drive results.

The solution had four parts:

  • a Telegram bot with deep-link UTM tracking;
  • PostgreSQL data storage;
  • a FastAPI admin dashboard;
  • filters, analytics and export.

As a result, campaigns became more transparent, the user flow is tracked automatically, and the team buying traffic got a working tool for analytics and scaling.

Common mistakes

Tags only in someone’s head

If campaign names live in a chat or a spreadsheet nobody updates, in a month no one remembers what a parameter means. The source must be stored in the database with a readable name.

Counting only starts

Someone pressed /start and did nothing. What matters is whether they reached a request, a payment or another target step. So the database should keep not only the source but also the events after it.

No admin panel

Nobody looks at data in a database without a convenient screen. You need filters by source and period, and export, so you can hand the data to an accountant or a partner.

Everything done by hand

If statuses and conversions are entered manually, the data goes stale. In the case, data synchronization is automatic.

Checklist before launch

  • Decide which sources you need to tell apart: ads, posts, partners, offline.
  • Decide which action in the bot counts as success.
  • Storage: where users, sources and events live.
  • A screen where the owner sees the result without a developer.
  • Data export.

Who needs this

Any business that brings people to Telegram from several places: a shop, a studio, a service with partners. If you invest in traffic, you should know what works.

What next

More about how I build bots is on the Telegram bot development page. To see how this would work for you, message my bot: https://t.me/chornuy7_tech_bot?start=src_blog. Tell me where your clients come from now, and I will say what is worth tracking.