Skip to content

Tracking User

To help improve and personalize the content of the Hello Retail products it is important that we have a way of tracking the behaviour of visitors on the webshop. All tracked actions are associated with a tracking user. The tracking user is identified by a trackingUserId. This trackingUserId is generated by Hello Retail.

When using the Hello Retail javascript the trackingUserId is generated automatically and stored in a first party cookie. When using the Hello Retail SDK methods, or when using the managed Hello Retail solutions you don't have to do anything to handle the trackingUserId your self. It is handled automatically.

If you want to use the REST API to create product recommendations, perform searches or serve category pages you will need to pass the trackingUserId as a parameter to the API your self. You have two ways of obtaining the trackingUserId. You can either use the SDK or our REST API.

Getting the trackingUserId using the SDK

You can use the SDK method ADDWISH_PARTNER_NS.api.user.get_tracking_id in javascript. If you pass a callback function to this method th callback will be called once the trackingUserId is availabel. The script will automatically store the in the cookie mentioned above, and will make sure you get the same value on subsequent calls for the same visitor.


Call the get_tracking_id() function, specifying a callback function - this callback function will be called with the user tracking ID passed along.


Argument Type Description
callback_function String The callback function you would like to have called after this function is executed. The trackingUserId is passed as an argument to the callback function.


This example will store the trackingUserId in a session cookie. You should be able to read this cookie on subsequent requests to you backend.

ADDWISH_PARTNER_NS.api.user.get_tracking_id(function(trackingUserId) {
  document.cookie="helloRetailTrackingUserId=" + trackingUserId + ";path=/";
An alternative approach could be to use and XMLHttpRequest to send the trackingUserId to your backend and store it in some form of session storage. Remember that the value is associated with a specific vistor, and should not be shared across different visitors.

Getting the trackingUserId using the REST API

The Hello Retail SDK uses a REST API endpoint to create a trackingUserId if a valid one is not found in the first party cookie. This endpoint can also be used directly. Notice that the endpoint will create a new trackingUserId on every request. The correct way of using this endpoint is to store the generated value in some form of session storage or in a cookie, so that it is associated with the visitor on the site. You should not generate a new trackingUserId on each request for the same user.


The endpoint is available at You use it by sending a HTTP POST request with a JSON body with the websiteUuid of the requesting site. The content type must be application/json or text/plain 1.

Example of the structure the JSON body must have:

    "websiteUuid": "4bb65cc4-f2d2-4eb0-80d9-9496f912d2cf"


The response will be a json object with a single id attribute. A successful response will have the 200 response code. The body of the response will look like this:

    "id": "62a0317d17698aa57d369db9"

If the API call fails for some unexpected reason return with a 500 response code. If you experience this please contact Hello Retail support.

  1. The reason for supporting text/plain is to allow requests to this endpoint, made from the browser, to be categorized as simple thereby avoiding CORS preflight requests. You can read more here