Analitic
Skip to content

Documentation

Installation, events, the server API and privacy.

Installation

One line in <head> on every page. Single-page apps need nothing extra: a route change counts as a pageview on its own.

<head>
  <script defer data-site="YOUR_SITE_ID" src="https://analitic.my-it.uz/js/da.js"></script>
</head>

Replace YOUR_SITE_ID with the id from your site settings.

Script options

The tracker is configured with attributes on the script tag.

Attribute What it does
data-site Site id. Required.
data-persist="1" Keeps a visitor id in localStorage. Needed for revenue attribution.
data-hash="1" Counts #fragments as separate pages.
data-outbound="0" Turns off outbound link tracking.
data-exclude="/admin/*" Paths to skip. Comma separated.
data-api Your own collector endpoint.

Custom events

The datafast function is available as soon as the script has loaded. The name is yours to choose; properties are optional.

datafast('signup', { plan: 'pro' });

// Идентификатор посетителя — передайте его на свой сервер,
// чтобы привязать к нему будущую оплату:
datafast.visitorId();

For an event to count as a goal, create a goal with the same name in the site settings.

Telegram

A referrer of "t.me" is the same for a Mini App, the in-app browser, a channel post and a private message. Analitic tells those apart on its own, but which post brought someone is only knowable if the post is marked.

Marking a post

Add a tg parameter to the link with a label of your choosing. Any value, up to 64 characters.

https://example.uz/catalog?tg=post_42

Mini App

Nothing to do: Analitic reads start_param from the Telegram SDK. Open the Mini App with t.me/bot/app?startapp=post_42 and post_42 shows up in the report.

An order placed in a chat

The order arrives in a private message rather than on the site. To tie it back to the channel: the "Message us" button on your site carries the visitor id, Telegram passes it to the bot as the start parameter, and the bot sends the payment event with that same id.

// 1. Кнопка на сайте
document.querySelector('#write-to-us').href =
    datafast.telegramLink('myshopbot');

// 2. Бот получает /start <visitor_id> и сообщает об оплате
POST https://analitic.my-it.uz/api/v1/event
Authorization: Bearer da_••••••••

{
  "name": "order_paid",
  "visitor_id": "<то, что пришло в start>",
  "amount": 350000,
  "currency": "UZS"
}

Works only with data-persist="1": without a stored id there is nothing to tie together.

What shows up in the report

Telegram Mini App, in-app browser or tagged link
Telegram post the tg parameter or start_param value

Server events and revenue

Payments happen on your server, not in the browser, so revenue is sent as its own request carrying the site token.

curl -X POST https://analitic.my-it.uz/api/v1/event \
  -H "Authorization: Bearer da_your_token" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "subscription_paid",
    "email": "customer@example.com",
    "amount": 19.00,
    "currency": "USD"
  }'

At least one of visitor_id, external_id or email is required, otherwise there is nobody to attach the event to. Get visitor_id in the page with datafast.visitorId().

Request fields

Field What it means
name Event name. Required.
visitor_id / external_id / email Who the event belongs to. At least one.
amount The sum, for revenue events.
currency Three-letter code. Defaults to the site currency.
occurred_at When it happened. Defaults to now.
props Your own event properties.

Privacy

A visitor is identified by a hash built with a salt that rotates every day. Tomorrow the same person gets a different identifier, so no cross-day profile exists. Nothing is written to the browser, no personal data is collected, and in the default setup no consent banner is needed.

The exception is data-persist. It keeps an id in the site's localStorage so a payment can be tied back to the first source. Without it, revenue attribution only works within a single visit.

Without data-persist the salt rotates daily, so a payment can only be linked to a visit within the same day. With it, across visits — but that is a write to the visitor's browser, and in the EU it may require their consent.

Country and city come from the DB-IP Lite database (CC BY 4.0). Nothing leaves the server: the database is local.

Checking the install

Open your site in a new tab and come back to the dashboard — numbers appear within seconds.

  • Nothing after a minute: check the script is in <head>, not <body>.
  • A load error in the console: the script URL is probably blocked by an ad blocker.
  • Traffic arrives but revenue does not: check the site token, and that the request carries visitor_id, external_id or email.
  • Pages you do not want are counted: add them to data-exclude.