Data source: Top.Mail.Ru

You can display ads to only people who have visited your site. For example, select an audience that added items to your shopping cart but didn't make a purchase and show ads to those people.

To use Top.Mail.Ru as a data source for advertising campaigns:
  1. Connect counter Top.Mail.Ru. If using counter Top.Mail.Ru for dynamic retargeting, specify events in the code
  2. Set goals for the counter
  3. Add a source to the segment
Step 1. Connect the counter Top.Mail.Ru

How to connect an existing counter Top.Mail.Ru

If you already have a counter Top.Mail.Ru,

  • enter the email address of the counter owner in the "Counter owner" field and the counter number in the "counter ID" field;
  • click "Send a request to bind".
Request to add a counter
You can send a request to add a counter from an advertiser's account only.

The e-mail, which is connected to the counter, will receive a letter with a validation link. Follow the link from the email and the counter will be linked to your myTarget account.

How to create a new counter Top.Mail.Ru

Create a counter Top.Mail.Ru. Fot this click the "Audiences" tab → "Counters Top.Mail.Ru" and click "Create counter".

Specify the data to create the counter:

  • The name of the counter — it will appear in the interface of the Rating and myTarget;

  • Resource address — the address and protocol of the site where the counter will be installed;

  • Your E-mail — a confirmation link will be sent to this e-mail address;

  • Password — needed to access the counter in Top.Mail.Ru and must contain more than 6 characters.

Enable the option "Use code for synchronization" below the counter to collect information about the visitors of your website. This data can be used as a data source.
Data to create a counter
After the counter is created will appear its code. Install it on all pages of your site inside the <BODY> block as soon as possible to its beginning.
Counter code sample
On the e-mail will be sent a letter confirming the addition of the counter to your account. Click the link in the email to complete adding the counter.

All counters are displayed on the "Audiences" tab → "Counters Top.Mail.Ru". You can copy the counter code at any time by clicking on the "Code" link next to the counter name.

After the counter has accumulated statistics (the status of the counter is "Running"), it can be used as a data source. If the counter does not receive data, check that the counter is installed correctly on the site, or contact the counter owner.
List of counters
The configured counters are displayed in the list.
Table with a list of counters
  • id - counter ID in myTarget.
  • Counter Name - The name of the counter you have set. To the left of the name is the counter id in On the right is a link to the code. Click on it to open and copy the generated counter code.
  • Goals - the number of goals that are configured for this counter. Click "Add" to edit the targets.
  • Look-alike - a link for creating a Look-alike audience based on your counter data. More details
  • Status - the status of the counter. The "Working" status means that the counter is active, data is being received. If the status is "Data not available", check that the counter is installed correctly on the site, or contact the owner of the counter.
  • Coverage - the coverage of the counter for the calendar week. Read about coverage statuses below. Click the icon next to the coverage to request and view a profile of the source audience. More about profiles
  • Segments - the number of segments in which the counter is used.
  • Owner - "mine" for counters that you added, "third-party owner" - counters that third-party owners have shared with you.
Coverage statuses
The table on the page "Counters Top@Mail.Ru" displays the coverage - the number of users covered by the counter for a full calendar week.

The "Coverage" field can contain values:
  • number - the number of users covered by the counter for a full calendar week;
  • yellow number means that this is not final data - coverage is still being calculated;
  • counting in progress - the segment size is currently being calculated. This may take some time;
  • less than 1000 - counters in which from 0 to 1000 users were found last week. Check that the counter is installed correctly on the site, or contact the owner of the counter.
Please note that the coverage of the counter may not coincide with the data of only the data that the counter collected after connecting to myTarget is reflected here. If the counter was connected to myTarget more than a year ago, then the data for the last 365 days will appear in the coverage. If less than a year ago, then the coverage shows data since the moment the counter was connected to myTarget.
Setting up a counter for dynamic remarketing
If you're going to use a counter for dynamic remarketing, write down the events you want to pass to myTarget in your code.

If the counter code is already set, add a special code for dynamic remarketing to it:
<!-- counter dynamic remarketing appendix -->
   <script type="text/javascript">
  	var _tmr = _tmr || [];
     	type: 'itemView',
     	productid: 'VALUE',
     	pagetype: 'VALUE',
     	list: 'VALUE',
     	totalvalue: 'VALUE'
<!-- // counter dynamic remarketing appendix -->
Add required events to the code (primary data source):

  • product – product page visit;
  • cart – add products to the cart or visit the cart page;
  • purchase – visit the purchase confirmation page (the fact of purchase).

We recommend placing counter and dynamic remarketing codes after the opening tag <body>.

Be sure to place the counter code (framed by tag <!-- counter --> ) before dynrem code (framed by tag <!-- counter dynamic remarketing appendix -->).

Example of placing counter codes and dynamic remarketing:
      <!-- counter -->
     	<script type="text/javascript">
        	var _tmr = window._tmr || (window._tmr = []);
        	_tmr.push({id: "Counter ID", type: "pageView", start: (new Date()).getTime(), pid: "USER_ID"});
        	(function (d, w, id) {
           	if (d.getElementById(id)) return;
           	var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; = id;
           	ts.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//";
           	var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
           	if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
        	})(document, window, "topmailru-code");
        	<img src="// ID;js=na" style="border:0;position:absolute;left:-9999px;" alt="" />
      <!-- // counter -->
      <!-- counter dynamic remarketing appendix -->
     	<script type="text/javascript">
        	var _tmr = _tmr || [];
           	type: 'itemView',
           	productid: 'VALUE',
           	pagetype: 'VALUE',
           	list: 'VALUE',
           	totalvalue: 'VALUE'
      <!-- // counter dynamic remarketing appendix -->
In the counter code, instead of the "Counter ID", should be specified the counter identifier that you selected when loading the feed.

In the dynamic remarketing code, instead of "VALUE" for the parameters "productid", "pagetype", "list" and "totalvalue" certain values should be specified. They can be set automatically, for example, with the help of a certain tool that generates the code for the pages of your site.

Description of dynamic remarketing options

productid (required)
Used to specify the identifier of the product (products) concerned by the event. For example, the product identifier to which the site page displayed to the user is dedicated.

The parameter value must necessarily correspond to the product identifier from the feed (element "offer", property "id"). It is for this identifier that the system understands what products the user is interested in, so that based on them, select products from the feed to be displayed in advertisements.

Example: productid: '123456'

If there are several products on the page, for example, on the cart page (pagetype: 'cart') or the purchase confirmation page (pagetype: 'purchase'), then their identifiers should be listed in the array (in square brackets separated by commas).

Example: productid: ['123', '456']
Used to specify the type of page or section of the site, or the event / action performed by the user on your site.

Values that must be sent (without these data, dynamic remarketing is impossible):

  • product – view product page or view information about a specific product;

  • cart – viewing the cart page, or adding a user to the cart without visiting its page;

  • purchase – view the purchase confirmation page (product purchase event / action).

pagetype: 'product'
Used to indicate the total cost of products. The parameter must contain the sum of the prices of all products specified in the parameter productid — for example, the sum of the prices of all products from the cart. If only one product is involved, then its current price. It makes sense to pass this parameter to the pagetype with the values product, cart and purchase.

Example: totalvalue: '499.99'
Used to specify the ID of the feed to which the products specified in the productid parameter belong. The ID is assigned to the feed when it is loaded (Audiences → Product feeds).

Example: list: '1'

If within one site you use several feed files, for example, different feeds to different cities, then they should be associated with one Top.Mail.Ru counter, but have different IDs. For example, you uploaded a feed for Moscow and assigned it an ID of 1, as well as a feed for Vladivostok, and assigned it an ID of 2. Therefore, when a product is shown to a visitor from Moscow, ID 1 must be specified in the list parameter, and ID 2 must be specified to a visitor from Vladivostok.

Examples of using dynamic remarketing code (for a site with one feed)

Product page (event / action: view information about a specific product).

Use the dynamic remarketing code with the indication pagetype: 'product', when displaying the product to the user he was interested in (specifically looked at information about a particular product).

If your site allows you to view information about different products without reloading the page, then you can dynamically update information about the product that the visitor is interested in - consistently make calls to the dynamic remarketing code with the corresponding values of the parameters productid and totalvalue.
<script type="text/javascript">
   var _tmr = _tmr || [];
      type: 'itemView',
  	productid: '12345',
  	pagetype: 'product', 
  	totalvalue: '1000.89',
  	list: '1'
Cart (event / action: view cart page, add item to cart).

Use the dynamic remarketing code with the indicatior pagetype: 'cart', if user navigates to the cart page and it is not empty, or the user has added some products to the cart without switching to it (without opening the cart page itself). Make calls to the dynamic remarketing code with the ID of all products currently in the cart.
<script type="text/javascript">
   var _tmr = _tmr || [];
      type: 'itemView',
  	productid: ['1234','5678','9012'],
  	pagetype: 'cart', 
  	totalvalue: '15000.45',
  	list: '1'
Purchase page (event / action: fulfillment of purchase).

Use the dynamic remarketing code with the following pagetype: 'purchase', if user has completed the order. Make calls to the dynamic remarketing code with the ID of all products purchased by the user.
<script type="text/javascript">
   var _tmr = _tmr || [];
      type: 'itemView',
  	productid: ['1234','5678','9012'],
  	pagetype: 'purchase', 
  	totalvalue: '15000.45',
  	list: '1'

Enable dynamic remarketing code through Google Tag Manager

Container creation

After creating an account in Google Tag Manager, you need to create a container. The container contains all the tags for a particular website. Therefore, you must give the container an appropriate name. For example, the container for can be called "".

To create a new container:
1. On the main page Google Tag Manager in the list of accounts, select the account you want and click on the "..." button. Then click on Create Container.
2. Enter the name of the container, select the "Website" option in the "Target Platform" section and click the "Create" button.
3. If the container is created together with the account, then on the main page click the "Create an account" button and on the next page add an account and create a container.

Container placement

After creating the container, a modal window containing the container JS code will appear. This code must be placed on each page of the site. How to place it correctly will be indicated in the modal window.

Adding Tags and Triggers

The steps to add a new GTM tag are:
1. On the main page, on the "Overview" tab, click on the "Add a new tag" button.
2. On the next page, enter the correct tag name and click anywhere in the area of the "Tag Configuration" page.
3. Then select the Custom HTML tag type.
4. In the next window, add the JS code of the TOP@mail.Ru counter and the JS code for dynamic remarketing.
5. In the advanced settings of the tag, in the "Activation settings" section of the tag, select "No restrictions".
Please note!
In the dynamic remarketing code, instead of "VALUE", the parameters "productid", "pagetype", "list" and "totalvalue" must be set to specific values. They can be set automatically, for example, using a tool that generates the code for the pages of your site.
In order for the previously created tag to work, you need to create a trigger, activation of which will trigger the dynamic remarketing JS code, which we added in the previous steps when adding a new tag.

To do this, you must sequentially perform the following steps:
1. Click anywhere in the "Triggers" area;
2. Add a new trigger by clicking on the plus sign:
3. Enter a meaningful name for the trigger and select the type of trigger "Window loaded".
Next, you need to determine when any or what events need to activate this trigger.

For example, we want this trigger to be activated when visiting the basket on the site.

To do this, you must:
  1. Click anywhere in the "Trigger Settings" area;
  2. In the group of checkboxes "Trigger activation conditions" select "Some events "Window loaded"";
  3. In the very first drop-down list on the left, select "Page URL", then "Contains" and, for example, /cart;
  4. Save changes by clicking on the "Save" button.
In this particular case, /cart as part of the URL is selected as an example only.

Publish changes

After you add the GTM tags and their corresponding triggers, you need to post your changes. To do this, on the "Workspace" tab of Google Tag Manager, click on the "Submit" button.
On the next page you need to enter the name of the published version and a brief description of the changes. Then click on the "Publish" button.

Features call code dynamic remarketing

Depending on the user's actions on the site, the dynamic remarketing code can be called an unlimited number of times without reloading the page, but all calls should be made only after calling the main counter code Top.Mail.Ru.

When calling the code in the global scope, to declare the _tmr object, it is enough to specify its name, for example:
<input type="button" id="addToCart" value="Add to cart">
<script type="text/javascript">
   jQuery('#addToCart').on('click', function() {
      var _tmr = _tmr || [];
     	type: 'itemView',
     	productid: '1234',
     	pagetype: 'cart',
     	list: '1'
  	return true;
If the code is called inside some JS-function or elsewhere, then you may need to declare the _tmr object as a method of the global window object, for example:
<input type="button" onclick="var _tmr = window._tmr || (window._tmr = []); _tmr.push({ type:'itemView', productid:'1234', pagetype:'cart', list:'1' }); return true;" value="Add to cart">
The examples above demonstrate an embodiment of sending data to myTarget about adding a product to the cart when the user clicks the "Add to cart" button.
Step 2. Set goals for the counter
When you set the counter Top.Mail.Ru it will start collecting data about all visits to your website. To refine into information, such as highlighting users who put items in the shopping cart but didn't pay for the order, set up goals.

To create a goal, click the "Audiences" tab → "Counters Top@Mail.Ru". Select the counter and in the "Goals" column click "Add". If you add a counter to which you do not have rights, the goals of the counter will not be shown until the rights are confirmed by the owner.

Click "Add goals" and select the source:
Viewed a specific directory on the site
To highlight those users who are interested in stock on your website ( in the URL of the page contain the string /actions/.

As a substring may be any part of the URL, for example, you define custom label: value result=ok fit for the pages view
Came from a specific site
To highlight users who came to your site from the site, in the Referrer field of the URL page contains a substring, specify
JavaScript event
Performed targeted actions on the page (for example, downloaded the file, added the product to the cart, filled out the form).

Used to receive events from JavaScript
To select the users that put in the basket arrows, in the Event field from JavaScript enter "arrows". To send an event named "arrows" from JavaScript when the event occurs, run the following JavaScript code:

_tmr.push({ id: 'counterID', type: 'reachGoal', goal: 'arrows' });

The event name must consist of Latin letters or numbers.
Deep of visit
Watched a certain number of pages
To highlight those who have studied your site and viewed at least 10 pages, enter 10 in the visit Depth field.
Stay time
Spent on the site a certain time (in seconds)
To highlight those who quickly left the site, in the time spent on the site field, enter, for example, a value of 5. The value must be at least 2 seconds.
Specify the name of the goal. You can also specify the numerical value of the goal: it is necessary to calculate the numerical indicator of the goals achieved.

From the moment you set up a goal, data on the achievement of goals will be collected. Information about site visits and the achievement of user goals is kept for 420 days.

Goal values

Each goal can have a Value - a fixed number attached to a specific goal. You need to specify it if you follow the indicators Revenue, ROMI, ACS in statistics.

Indicate the value as an integer: if the amount is in kopecks, round the number.

When reaching a goal with a value, the value will be summed over all the achievements of the goal.

To send a target with the name NAME and a value VALUE from javascript, place the actual counter code (received after May 20, 2013) at the beginning of your page, and when you reach the goal, run the following javascript code:
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({ id: "ID-счетчика", type: "reachGoal", goal: "NAME", value: VALUE });
More about goals and goal values read in counter Top.Mail.Ru help article.
Examples of setting goals for dynamic remarketing

Goal "Visited cart" (URL: /cart/)

  1. Go to the "Audiences - Top.Mail.Ru Counters" page, click "Add" in the "Goals" column of the counter that you selected when loading the feed;
  2. In the window that opens, click "Create goal", select "Substring from the URL";
  3. Fill the form:
  • Specify in the field "Type of purpose" the value "Initiation of order placement";
  • Specify the name of the goal (for example, "Visited cart");
  • In the field "URL of the page contains a substring" specify the part of the URL of your site relating to the basket (for example, if the basket is located at the URL, then specify /cart/ in this field);
  • Click the "Save goal" button. The created target will appear in the list of targets.
Goal "Visited cart"

Goal "Added to cart" (JS: addToCart)

  1. Go to the "Audiences - Top.Mail.Ru Counters" page, click the "Add" button in the "Goals" column of the counter that you selected when loading the feed;
  2. In the opened window, click the "Create goal" button, select "JavaScript event";
  3. Fill the form:
  • Enter the value "Add to basket" in the "Goal category" field;
  • Set the name of the goal (for example, "Added to cart");
  • In the field "Event from JavaScript" enter addToCart;
  • Click the "Save goal" button, the created target will appear in the list of targets.
Goal "Added to cart"
Step 3. Add sources to the audience segment
Click the "Audience" → "List of segments" and click "Create segment".

Click "Add segments": the list contains the segments and data sources you added earlier. You can create new segments based on existing segments.

Select one or more sources and click "Add segment". You can add or exclude from the segment users who have achieved the specified goals, and the time. Then click "Add segment".
Add segment
Was this article helpful?
Tell us why did you dislike the article and how we can get better