If your question is about a mobile device, please go back to the mobile version.

Pixel setup for dynamic retargeting

If you lack experience in working with JavaSript, we strongly recommend that you seek the assistance of your website developers or other specialists to configure dynamic retargeting.

How to get a pixel?
  1. Go to your advertising account.
  2. Choose the Retargeting section.
  3. Go to the Pixels section.
  4. Click on the Create pixel button.
  5. Specify the pixel name, domain and your website subject
    .
    Copy the generated code and get PIXEL_ID. This ID must be in the code that you put on your website.
How to install product events on the website?
In addition to installing the retargeting pixel code on your website, it is necessary to specify parameters and types of events for which audience data will be collected. You can read technical documentation for installing a pixel here. For correct operation, you will need PIXEL_ID and price_list_id that you will get while uploading a price list.

Types of product events, products_event parameter:
  • view_home � to view the homepage;
  • view_category � to view the catalogue categories;
  • view_product � to view the product card;
  • view_search � to view the search page;
  • view_other � to view any other pages;
  • add_to_wishlist � to add products to the wishlist;
  • add_to_cart � to add products to the cart;
  • remove_from_wishlist � to remove products from the wishlist;
  • remove_from_cart � to remove products from the cart;
  • init_checkout � to start purchasing;
  • add_payment_info � to enter payment information;
  • purchase � to make a purchase.

Parameters:
  • products: array // optional, example: [{"id":"123","recommended_ids":"23,44"}] A list of products with additional information on them, with a description of the product type below.
  • products_recommended_ids: string // optional, example: qwe789,rty777 A list of recommended products, when there are no specific goods or you want to recommend some products without reference to any specific goods.
  • category_ids: string // optional, example: 12,23,34 A list of product categories, when there are no specific goods or you want to cover some additional category completely.
  • business_value: int // optional, example: 1000 The value of this event for business in notional units, from 1 to 1,000,000.
  • currency_code: string // optional, example: RUR Currency for the price and price_old fields.
  • total_price: int // optional, example: 3000 The total cost of goods from the products field.
  • search_string: string // optional, example: ����� ��� �������� A user�s search query.
It is highly desirable that for most events (even view_home) one of the products fields, category_ids, products_recommended_ids, be filled.


Fields of the product object:
  • id: string // example: abc123 Product ID from the price list.
  • group_id: string // optional, example: 22 Group of products. Is the user is viewing not a specific model, but all variants of the model.
  • recommended_ids: string // optional, example: qwe789,rty777 ID of recommended products for a specific product or group of products.
  • price: int // optional, example: 1000 Special price for a specific product or group of products for a certain user.
  • price_old: int // optional, example: 2000 Old price for the user. Counted if the price field is set.
  • price_from: bool // optional, example: 1 If set, the price field specifies the price �from�. Counted if the price field is set.

Call example:
First connect vk.com/js/api/openapi.js and initialize the pixel using VK.Retargeting.Init()


// PHASE I: Initialisation phase
<div id="vk_api_transport"></div>
<script type="text/javascript">
  window.vkAsyncInit = function() {
    VK.Retargeting.Init(PIXEL_ID);
  };

setTimeout(function() {
    var el = document.createElement("s�ript");
    el.type = "text/javascript";
    el.src = "vk.com/js/api/openapi.js?150";;;
    el.async = true;
    document.getElementById("vk_api_transport").appendChild(el);
  }, 0);
</script>

// PHASE II: When product event should be fired
// Detailed info (in Russian) https://vkcom.github.io/vk-ads-retargeting-demo/index.html
const eventParams = {
"products" : [{"id":"456", "recommended_ids":"abc456,def789"}, {"id":"672", "group_id":"678","recommended_ids":"abc456,def789"}],
"products_recommended_ids" : "55,166,754",
"business_value" : 88,
"total_price" : 34899
};
VK.Retargeting.ProductEvent(PRICE_LIST_ID, "view_product", eventParams);

Detailed call description:
VK.Retargeting.ProductEvent(PRICE_LIST_ID, products_event, { <parameters> });
price_list_id: int // ex: 12345 // Price list ID.
products_event: string // ex: view_product // Product action type (see above).
Pixel installation using Google Tag Manager
The installation can be performed through Custom HTML Tag.

<div id="vk_api_transport"></div>
<script type="text/javascript">
// Connect OpenAPI
  setTimeout(function() {
    var el = document.createElement("s�ript");
    el.type = "text/javascript";
    el.src = "vk.com/js/api/openapi.js?148";;;
    el.async = true;
    document.getElementById("vk_api_transport").appendChild(el);
  }, 0);
// Callback that will be called after initialization of OpenAPI
  window.vkAsyncInit = function() {
// Pixel initialization
    VK.Retargeting.Init(PIXEL_ID);
// Here fill in parameters for sending
// Sending event
    VK.Retargeting.ProductEvent(price_list_id, "view_product", eventParams);
};
</script>

Code example for Google Tag Manager:
<div id="vk_api_transport"></div>
<script type="text/javascript">
  setTimeout(function() {
    var el = document.createElement("s�ript");
    el.type = "text/javascript";
    el.src = "vk.com/js/api/openapi.js?148";;;
    el.async = true;
    document.getElementById("vk_api_transport").appendChild(el);
  }, 0);
window.vkAsyncInit = function() {
    VK.Retargeting.Init(PIXEL_ID);
    VK.Retargeting.Hit(); // This is instead of the first pixel call
    // Event generation for dynamic retargeting
    // Viewing products
    // This is a sample code to collect product data, it should be replaced with a code specific to your project.
    if (window.location.href.search(/catalog\/[0-9]+\/[0-9]+/) > 1) {
      var eventParams = {
        "products": [{"id": gtm_rem_vk_product_id, "price": gtm_rem_vk_price, "price_old":gtm_rem_vk_price_old}]
      };
      // Sending event
      VK.Retargeting.ProductEvent(PRICE_LIST_ID, "view_product", eventParams);
    }
};
</script>
Pixel installation using DigitalDataManager
Users of the DigitalDataManager marketing infrastructure management platform can benefit from a ready-made solution.
To do this, log in to the platform, go to the "Integration" tab, click on the VKontakte logo box, specify your PIXEL_ID and set up event transmission.
Detailed integration instructions are available at the link.
Your search for returned no results.
Try using other keywords, e.g.: "delete profile", "create chat".
Check your request for misprints.