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;

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 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.

🚧

Note

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) {}
  })
</script>