Skip to main content

Main System Tracking Code

Description

The main system tracking code must be installed on every page of the site in the <head> section.

It should only be called once on a page; calling this script multiple times can lead to incorrect operation of other tracking codes and the platform as a whole.

Online Store Identifier

To identify an online store in the API, the partnerId parameter is used. The value of this parameter is issued upon registration in the Retail Rocket system and can be obtained either by a request to a Retail Rocket account manager, by contacting the support service (support@retailrocket.net), or in the Retail Rocket personal account.

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

tip

The value is public and can be used in the open.

Code Example

<script type="text/javascript">
var rrPartnerId = "%%parameters.partnerid|partnerId%%";
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 set and track cookies for users.

This variable is optional and should be used if the website requests user consent for working with cookies.

By default, you should call the main tracking code with the value true, and then change it to false if the user has accepted the cookie policy.