Tracking user
If you want to get personalized recommendations for a specific user, either via the REST or JavaScript SDK, you will need to supply the specific users Hello Retail tracking ID. This tracking ID is only available through the JavaScript SDK due to the use of cookies for tracking. You will, therefore, need to get this value using the method specified below, and then send it back to your backend to be used for the REST-API.
Note this method is only avaliable through the JavaScript SDK.
Get tracking user
Example
1
ADDWISH_PARTNER_NS.api.user.get_tracking_id(callback_function(trackingUserId));
Copied!
Simply call the get_tracking_id() function, specifying a callback function - this callback function will be called with the users 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 tracking user ID is passed as an argument to the callback method.
1
ADDWISH_PARTNER_NS.api.user.get_tracking_id(function(trackingUserId) {
2
// We will call your function, as soon as we have the tracking user id.
3
4
// Here you can e.g send it directly to your backend using jQuerys ajax helpers:
5
jQuery.post("/url/at/your/backend", {
6
tracking_user_id: trackingUserId
7
});
8
});
Copied!
Please make sure to alter the example code, to ensure the visitors tracking ID are parsed accordingly to you backend – if you intend to use the REST-API to serve the product recommendations yourself, through your backend.
Last modified 1yr ago
Copy link