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.
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).

Optional events:

  • home – visiting the advertiser's home page;
  • category – visit the page with a list of products of a certain category;
  • searchresults – visit product search results page;
  • other – visiting any other page of the site.

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).


  • home – view home page;

  • searchresults – view a page with site search results;

  • category – view product category page;

  • other – view any other page (or any other action) that is not suitable for other values.

Example: 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'

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.
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?