Identifying the visitor by the Visitor ID
Another way of identifying the Visitor on your page is through the session ID, also called Visitor ID. This ID is created by Konduto the moment your customer starts browsing on your page.
On some sites it is not possible to identify the visitor of the page by the Customer ID. This usually occurs because there is no login process involved in the steps or due to being connected to the system using the guest mode, or guest checkout.
By choosing this mode, you need to retrieve the visitor ID by calling the method getVisitorID ()
of our JavaScript. This method will return an ID that represents the connection between the navigation data received during the process and the "author" of the purchase. This value should be passed on to our API through the visitor
field.
Use the code below in your site without changes:
Example of visitor ID recovery
var visitorID; (function() { var period = 300; var limit = 20 * 1e3; var nTry = 0; var intervalID = setInterval(function() { var clear = limit/period <= ++nTry; if (typeof(Konduto.getVisitorID) !== "undefined") { visitorID = window.Konduto.getVisitorID(); clear = true; } if (clear) { clearInterval(intervalID); } }, period); })(visitorID);
Note that the above code contains the implementation of a setInterval
, as explained below in 'identifying the visitor by the Customer ID.'