Main tracking code

Description

This code must be installed on each page of your website in the <head> section.

This tracking code should be called only once on the page, multiple calls to this script may lead to incorrect operation of other tracking codes.

πŸ“˜

Online store identificator

The API uses the partnerId parameter to identify the online store. The parameter's value is generated after registration in the Retail Rocket system, and can be obtained by a request to account manager, or in the Retail Rocket personal account.

This identifier must be passed as a value to the variable rrPartnerId in the main tracking code.

πŸ‘

The value is public and can be used openly

Example of a main tracking code

<script type="text/javascript">
  var rrPartnerId = "<<name>>";
  var rrApi = rrApi || {};
  var rrApiOnReady = rrApiOnReady || [];
  var rrDisabledCookies = true/false;
  (function(d) {
    var ref = d.getElementsByTagName('script')[0];
    var apiJs, apiJsId = 'rrApi-jssdk';
    if (d.getElementById(apiJsId)) return;
    apiJs = d.createElement('script');
    apiJs.id = apiJsId;
    apiJs.async = true;
    apiJs.src = "//cdn.retailrocket.net/content/javascript/tracking.js";
    ref.parentNode.insertBefore(apiJs, ref);
  }(document));
</script>

πŸ“˜

Cookie management

The value of the rrDisabledCookies variable indicates whether the Retail Rocket platform will assign and track cookies for users.

This variable is optional and should be used if the website requests user consent to use cookies.

By default, the main tracking code should be called with the value true, and then changed to false if the user has accepted the cookie policy.