Identifying the visitor by the Customer ID
When we capture the navigation information on your site, it is necessary to create a link between the behavior observed on the site and the purchase transaction that comes into our system. We create this link upon identification of the visitor on your page.
It is very common for the user to browse your website anonymously until he finally proceeds to checkout, upon which it will be necessary to log in. Or, if the user still does not have an account, he will need to fill out a new registration.
When the user identifies himself you should call the method setCustomerID ()
of our JavaScript, assigning an exclusive identifier for that user. This identifier needs to be an exclusive ID created in your store for the purpose of internal control. Alternatively, the client's email can also be used.
The goal is that when you call our API with the order information, this same identifier is sent through the field customer.id
of the requisition JSON.
Observe the code below. You can use it on your site just by changing the value of the customerID
variable .
Example of sending a client ID during browsing session
var customerID = "37"; define the customer ID (function() { var period = 300; var limit = 20 * 1e3; var nTry = 0; var intervalID = setInterval(function() { // loop to retry sending var clear = limit/period <= ++nTry; if (typeof(Konduto.setCustomerID) !== "undefined") { window.Konduto.setCustomerID(customerID); // send the ID to Konduto clear = true; } if (clear) { clearInterval(intervalID); } }, period); })(customerID);
You'll notice that the implementation above relies on a setInterval
, that will try multiple times to send the client ID to Konduto. We use this interval because our JavaScript is the last thing to be triggered on the site and is loaded asynchronously by the browser.
There are cases where the site tries to send the ID while our JavaScript has not yet been loaded, generating an Uncaught error ReferenceError: Konduto is not defined
It is not necessary to make changes in the code snippet above, because it has been tested in various scenarios to ensure that its integration occurs quickly and easily for you.
Another form used to identify the visitor is using a Session ID created by Konduto. To become familiarized with this other form of identification, click here or see the relevant article below.