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

Setting up retargeting by site events

You can flexibly configure the retargeting on the website and create advanced conditions for collecting users using events. Here are a few simple examples:
  • button click;
  • completing a form;
  • use of search;
  • signing up on a website.


The list of events is limited only by your imagination. For example, you can collect a retargeting audiences of users from Nizhnevartovsk who started to fill out an application or place an order, but did not complete the action. Any sequences that you can identify on your website can be used in retargeting. In order to use your website events you need to have basic knowledge of HTML and JavaScript. In addition, events are integrated with Google Tag Manager for easy operation.

How to connect events to the website?
First, you need to connect the VKontakte JS API library to the website where you want to record events:

<script src="htt�s://vk.c�m/js/api/�penapi.js?144"></s�ript>

Then initialize the retargeting pixel code:

<script>
     VK.Retargeting.Init('VK-RTRG-96471-KZ24cpR');
</script>

where VK-RTRG-96471-KZ24cpR is a unique retargeting pixel code.

To get a unique code, create a VKontakte retargeting pixel.
How to use website events in retargeting?
To track events on your website, you need to call JS API methods at the time of occurrence of any event.
In total there are three methods:

VK.Retargeting.Hit() �using the method, you can track visits to website pages. For example
<script>
    VK.Retargeting.Hit();
</script>


VK.Retargeting.Event(eventName) � is a method for generating events. You yourself add a method to various website elements. For example, you can add a method call to the handler for clicking the �Sign Up" button (in this case the event name is 'click-reg-button'):
<button onclick="VK.Retargeting.Event('click-reg-button')">
    Sign Up
</button>


Another example: to begin collecting users who started filling out a registration form, you need to add the event when the form is being filled out:
<script>
    var formFillStarted = false;
    $('form').on('change', function () {
        if (!formFillStarted) {
            formFillStarted = true;
            VK.Retargeting.Event('form-fill-started');
        }
    });
</script>


VK.Retargeting.Add(audienceID)is a method for adding users to an audience. Users can be added to the audience using JS API methods. To do this, you must specify the retargeting audience ID (the audience must be previously created in the interface).

To find out the retargeting audience ID, find the audience you need in the Audiences tab, click on its name and select Edit rule in the drop-down menu. In the window that opens, find the audience ID.
How to set up event rules?
After you have marked the website events, you need to set up rules for retargeting audiences, under which users will be collected.
Without rules, your users will be counted by VKontakte, but will not be saved in the audience, therefore, you will not be able to use them for advertising.

To set up event rules through the interface:
  1. Go to your advertising account.
  2. Select the Retargeting section
  3. Click on the Create audience button.
  4. Specify the audience name and choose Get with pixel.
  5. Choose a VKontakte pixel that will populate the audience. This should be the pixel that is installed on your website with the �on� status in the Pixels tab;
  6. Set the rules for users to belong to the audience.

Conditions for users to get in an audience can be set using the following parameters:
  • Event contains. Specify a part of the event name � as a rule, this option is used if there are several events to be tracked and they can be combined using one condition.
  • Event matches. Specify the full name of the event.
  • Event matches a regular expression. For advanced users: tracking events that match patterns.



You can also specify the number of days for which users will remain in the audience after the event. After a specified period, users are removed from the audience..

Finally, click on the �Create� button to save the audience: after saving, it will appear in the �Audiences� list and the selected pixel will be specified as the source.

See https://vkcom.github.io/vk-ads-retargeting-demo/ for a detailed JS API description and an example of use.
Your search for returned no results.
Try using other keywords, e.g.: "delete profile", "create chat".
Check your request for misprints.