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 for Europe region

<script type="text/javascript">
  var rrPartnerId = "<<name>>";
  var rrApi = rrApi || {};
  var rrApiOnReady = rrApiOnReady || [];
  (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>

Example of a main tracking code for LatAM region

<script type="text/javascript">
  var rrPartnerId = "<<name>>";
  var rrApi = rrApi || {};
  var rrApiOnReady = rrApiOnReady || [];
  (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 = "//mcdn.retailrocket.net/content/javascript/trackingm.js";
    ref.parentNode.insertBefore(apiJs, ref);
  }(document));
</script>