Session management

Pointer to the customer - link

Some API calls require you to identify the visitor for whom the request is applicable. To do this, you need to use a pointer to the user - the link parameter.

link - it's a named string pointer to the customer, intended to pass information about the customer to Retail Rocket

For the product recommendations, it is passed as a query parameter, and for the user behaviour tracking API, it is passed in the request body.
link consists of a name and value, in the query string the name and value are separated by a comma, example: ?link=card,12345, where card is the name and 12345 is the value.


More about link parameter

Using link allows you to combine data from various sources into one profile, for example:

  • Website;
  • Mobile app;
  • Offline stores;
  • Call-centres;

Identifier sessionExternalId

As an alternative to using a session, you can pass the user's session ID in the sessionExternalId parameter. The identifier must be generated on the web-store side and have the following properties:

  • Consist only of number and letters;
  • It is any string up to 50 characters long;
  • Should be unique for every mobile app installation;
  • Should not contain any customers personal data (for example email);
  • Should not have changed when authorizing or changing accounts within the same application installation;



When a visitor first time appears on a website or mobile app, generate a GUID and use it as the sessionExternalId for API requests.



While using sessionExternalId as the session identifier, the user behavior tracking API must be used with the following base URL for requests:

Using session (cookie)

The Retail Rocket platform has the possibility to combine the integration of user behaviour tracking done via the JS SDK with product recommendations that can be requested via the API.

In order to do this, in recommendation requests, instead of the link / sessionExternalId parameter, you must use the session parameter, where session is an anonymized user identifier. It is contained on the website in the rcuid cookie, which is used for tracking user behaviour during JS SDK integration.



While using the session parameter, to evaluate the effectiveness of recommendations, it is necessary to use special methods of interaction with recommendations.

You can get a value of rcuid cookie by using the following JS method:

<script type="text/javascript">
    (window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
    try{ window.rrVisitorSessionId = retailrocket.api.getSessionId(); } catch(e) {}