Install the Web counter code on all pages of your site. You need to place the code inside the BODY block as high as possible.

You can copy the code from the Web counter application tab:

To learn how to install the counter using Google Tag Manager, see the attached section. Examples for WordPress, Ucos, HTTPS, etc. refer to the Top Mail.Ru documentation


Track users

Set the UserID parameter to track user stats, not only device. It's a unique user identifier in the project, that should remain unchanged even when user switch devices. The parameter allows you to estimate the size and activity of user base, regardless of the number of user devices. Also you can keep your customer data consistent if a user changes a device.

It's essential to set the parameter before tracking goals to pass user identifier with every goal. Use the _tmr.push raw to install the UserID:

var _tmr = window._tmr || (window._tmr = []);
 _tmr.push({ type: 'setUserID', userid: "UserID" });

To turn off the user tracking delete UserID:

var _tmr = window._tmr || (window._tmr = []);
 _tmr.push({ type: 'deleteUserID' });

We recommend installing UserID as described above. But if web page have a several counter you can pass UserID as a separate parameter in the _tmr.push row:

var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "counter ID",  type: "pageView", start: (new Date()).getTime(), userid: "UserID" })

If UserID was set to the application with an existing registered users, MyTracker can't calculate exact Lifetime metrics without first visit date. For pre-registered users, Lifetime stats will be count on the date of the first tracked event with UserID (first hit or goal).

Track goals

To track user activity, you should send a goal from the JavaScript code of the website. To do, write a code that lets you know about the reaching goal condition and send data to the server:

Registration. To track user registration, place the counter code at the beginning of your page, and at the time of registration send the goal mt_registration using JavaScript code:

_tmr.push({ id: 'counter ID', type: 'reachGoal', goal: 'mt_registration', userid: 'UserID'  });

Login. To track user authorization, place the counter code at the beginning of your page, and at the time of authorization send the goal mt_login using JavaScript code:

_tmr.push({ id: 'counter ID', type: 'reachGoal', goal: 'mt_login', userid: 'UserID'  });

Custom event. To track any event with a custom name, place the counter code at the beginning of your page, and at the time of event execute the following JavaScript code:

_tmr.push({ id: 'counter ID', type: 'reachGoal', goal: 'customEvent' });

The name of the goal for custom events must consist of Latin letters or numbers. We recommend naming the goal exactly as it's called in your mobile SDK. This will simplify the analysis of data getting from different platforms.

You can get a ready-to-use code in the Top Mail.Ru, see details in section Events from javascript. To send an app version, the params and value of custom events, you need to modify the code as described below.

MyTracker gathers only those goals that sent from the JavaScript code. Offline events and Fixed condition can be checked in the Top Mail.Ru.


You can send goal parameters with custom events. For example, for the "Order" event it can be an order id, terms of delivery, etc. Use the params field:

var EventParams = { logged: true, ... };
_tmr.push({ id: 'counter ID', type: 'reachGoal', goal: 'customEvent', params: EventParams });

As a param value, you can send any JavaScript object with one nesting level.

You can pass parameters of custom events, but not registration and login params


Custom events can have a value — a fixed number attached to a specific goal. By default, it gets the value from your goal settings.

To send goal value, use the field value:

var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ id: "counter ID", type: "reachGoal", goal: "customEvent", value: 50 });

Currently, you can get value stats through Raw API.

You can pass the value of custom events, but not registration and login value

App version

With each goal, you can send the app version parameter. For example, if you need to group stats by SAP versions and run a/b test.

To send the app version, use the field version:

var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ id: "ID счётчика", type: "reachGoal", goal: "customEvent", version: "1.2.3-rc4" });

S2S tracking

To send data from your server to MyTracker (for example, untracked data, offline events, etc.), you may need a special device identifiers — lvid.

It's essential to collect lvid as soon as possible and send identifiers to your server if you use this ID to work with S2S API.
Making API requests instead of instanceId, you can use UserID.

You can get lvid through a special javascript code:


The getClientID method is only available after loading the counter on the page. Therefore we recommend using the callback function, which will call methods only when the load is complete.

var _tmr = window._tmr || (window._tmr = []);
    type:     'onready',
    callback: function() {
        tmrLvid = _tmr.getClientID();
        /* here is your code for sending lvid to the server */

Regardless of the javascript code used, the identifier will be sent if the user's browser does not have an ad blocker, and the counter had time to load before the user left the page