var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ type: 'setUserID', userid: "您的UserID" });
在您网站的所有页面上安装网络计数器代码。该代码应在开始前尽早放置在BODY
模块内部。
You can place the code manually, use Google Tag Manager, or use the official plugin for WordPress, 1C-Bitrix, Joomla, or OpenCart.
Copy the code from the Web counter application tab:
为了实现对设备和用户网站的跟踪信息统计,请设置UserID
参数。这个参数是您项目中用户的唯一ID,即使用户通过其他设备进行登录,该ID仍保持不变。设置该参数以后,无论用户使用多少设备,您都可以评估应用软件受众的规模以及活动详情。如果用户决定更换设备,您也不会丢失用户数据累积的历史记录。
重要的是一定要在目标跟踪之前设置参数,以保证每次跟踪用户时,都会发送有关UserID
。请用_tmr.push
字符串设定用户ID:
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ type: 'setUserID', userid: "您的UserID" });
如需禁用用户跟踪,请删除UserID
:
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ type: 'deleteUserID' });
我们建议按照上述方式设置UserID标识符,但是如果网页上安装了若干计数器,可以把UserID
在 _tmr.push
字符串中作为单独参数传递:
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "您的ID", type: "pageView", start: (new Date()).getTime(), userid: "UserID" })
如果在设置UserID
之前,在应用程序中形成了已注册用户的数据库,那么MyTracker将无法获取有关该用户注册时间的数据,这意味着需要确定用户首次访问的日期,并进行准确的生命周期指标计算。对于此类用户,生命周期统计将根据UserID
首次目标跟踪的日期进行计算。
为了跟踪访问者的操作,请从网页javascript中设置目标发送。为此,您需要编写一个代码,以确定目标实现的事实,并将有关目标的信息发送到服务器。
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 goal parameters and the app version, you need to modify the code as describe below.
MyTracker只能跟踪从网页javascript中所发送的目标。有关脱机事件或固定条件的数据只能在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
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" });
The web counter can send some events to MyTracker automatically, not requiring you to add additional code to the website. To track events, turn on the option in the MyTracker interface:
If the toggle is ON, the counter automatically tracks the following events:
It might take up to four hours for the tracking to start or stop after you toggle.
To analyze the collected data, use the "Automatic event name" dimension, the "Automatic events" metric, and the same name filter. For details, refer to the Web tracking section.
If your website is an online store or any other e-commerce service, you can enable the Ecommerce events tracking: order placement, adding a product, full or partial payment of the order, canceling and refunding.
To collect data, you need to add additional code to your site and mark up events. For the instruction, refer to the Ecommerce section.
You can use the S2S API to send data to MyTracker. For example, to send offline events or untraceable counter data.
To send data from your server to MyTracker, you might 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 for work with S2S API.
You can use UserID
instead of lvid
,
but in this case, S2S data will generate stats only on users,
but not on devices. Learn more
You can get lvid
through a special javascript code:
_tmr.getClientID();
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 = []);
_tmr.push({
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
To track pageviews from the regions where the VK services are not available, use the alternative CDN — switch the counter code to COM domain.
For details, refer to the Alternative CDN section