Bot connection and API

1. The click code arrives in the bot

The link page button leads to https://t.me/<bot>?start=<prefix><code>. The code is the last 8 characters (Latin letters and digits). The bot receives /start ad_c8Fk2pQx — save it next to the user.

WhatsApp: the code arrives in the text of the first message. Max: the start parameter. VK: the message ref parameter. Site: ?clck=<code> (or substitute {click_id} in the address). A Telegram channel does not pass the code through someone else's invite link — for channels there is the “with subscription tracking” mode (below).

Salebot, BotHelp, Leadtex, Puzzlebot, SmartSender — webhooks without a programmer · Direct: pay for conversions

Telegram channel with subscription tracking

Make the service bot an administrator of the channel (the “Invite users” permission) and link the channel in the dashboard. A link with the destination “Telegram channel with subscription tracking” gives each click its own invite link — joining through it becomes the subscribe event, leaving is unsubscribe, and after 1, 7 and 30 days — retained_1d, retained_7d, retained_30d. They go to Metrica as regular events (goals clck_subscribe, clck_retained_7d…).

“Gift for subscribing” option: the button leads to the service bot, which shows “Subscribe” and “Check subscription” and, after the check, sends your gift — text, a link or a file.

2. The event is sent to Clck.now

POST https://clck.now/api/v1/events
Authorization: Bearer ck_…
Content-Type: application/json

{"click_id": "ad_c8Fk2pQx", "event": "paid", "value_minor": 99000, "currency": "RUB", "external_id": "order-1842"}
FieldWhat it is
click_idthe click code or the whole start parameter with the prefix
eventlead, paid or your own name: lowercase Latin letters, digits, _
value_minoramount in kopecks (optional)
currencyISO 4217, RUB by default
external_idyour order number; a repeat with the same number does not create a second event (response 200, "duplicate": true)
chat_user_iduser id in the messenger — for Metrica chats (optional)
occurred_atevent time, ISO 8601 or unix (optional, otherwise the request time)

Responses: 201 — created, 200 — repeat, 400 — error in the body, 401 — invalid key, 404 — click not found in the project. GET /api/v1/clicks/<code> — check a code.

3. Metrica and Direct

In Metrica, create a goal of the “JavaScript event” type with the identifier clck_paid (for the lead event — clck_lead; you can set a different identifier in the project). Get an OAuth token with the right to manage the tag and enter it in the dashboard together with the tag number. Every 10 minutes events are uploaded as offline conversions — by ClientID if it was received on the page, otherwise by yclid. Events for clicks older than 21 days are not uploaded. A button click on the page is the goal clck_click.

Example: a bot on aiogram 3

import aiohttp
from aiogram import Router
from aiogram.filters import CommandStart, CommandObject

router = Router()
CLCK_KEY = "ck_…"

@router.message(CommandStart())
async def start(message, command: CommandObject):
    if command.args:
        await db.save_click(message.from_user.id, command.args)   # e.g. "ad_c8Fk2pQx"
    await message.answer("Hello!")

async def on_paid(user_id, order_id, amount_minor):
    click = await db.click_of(user_id)
    if not click:
        return
    async with aiohttp.ClientSession() as s:
        await s.post("https://clck.now/api/v1/events",
                     headers={"Authorization": f"Bearer {CLCK_KEY}"},
                     json={"click_id": click, "event": "paid", "value_minor": amount_minor,
                           "currency": "RUB", "external_id": str(order_id)})