Session management
User pointer link
For some API calls, it is required to identify the visitor for whom this request is applicable. To do this, you need to use a pointer to the user - the link parameter.
linkis a pointer to a visitor: a pair consisting of two parameters -link.name, which specifies the name of the session, andlink.value, which passes the session identifier.- The values passed inside these parameters are arbitrary (for example,
link.name— "user session",link.value— "session ID").
For the API for receiving product recommendations, it is passed as a query parameter, and for the API for tracking user behavior - in the request body.
Using link allows you to combine data from various sources into one profile, for example:
- Website;
- Mobile app;
- Retail outlets;
- Call centers;
Using session (cookie)
The Retail Rocket platform also has the ability to combine the integration of user behavior tracking, made through the JS SDK, with product recommendations that can be requested through the API.
To do this, in recommendation requests, instead of the link.name and link.value parameters, you must use the session parameter, where session is an anonymized user identifier. Contained on the site in the rcuid cookie, which is used when tracking user behavior with JS SDK integration.
When using the session parameter, to evaluate the effectiveness of recommendations, as well as to account for sales through product recommendations, it is necessary to transmit special events of interaction with recommendations.
You can get the rcuid value using the following JS method on the site:
<script type="text/javascript">
(window["rrApiOnReady"] = window["rrApiOnReady"] || []).push(function() {
try{ window.rrVisitorSessionId = retailrocket.api.getSessionId(); } catch(e) {}
})
</script>