Identification and cookies
This guide will help you understand:
setContactId
Identification through email click
Identification on site
Best practices about cookies and identification
Important steps to ensure during implementation
Once the script is implemented it will generate a unique client ID and store it in a first-party cookie named _va. All web activities in the browser will be linked to that client ID via the cookie. When the user clicks on a link in an email from Engage, the tracking script reads the contact ID from the URL (vtid) and stores it in a cookie named _vaI. This cookie holds the Voyado contact ID of the identified user. This way, web activities can be connected to a specific contact in Engage.
Using setContactId() on identified users
This method will set cookie “_vaI”. Invoke this method only when the user has been identified by the website, e.g. sign in. Be cautious, the user might already be identified (e.g. by email link click), and invoking this method incorrectly might clear existing identification. setContactId() will not generate an HTTP request to the Collect endpoint.
Param | Type | Description |
---|---|---|
*contactId | string | Voyado Engage contact id |
va("setContactId", "contactId");
Automatic identification through email click
Customer (contact) receives a marketing email sent from Engage
They select the link that leads to the e-com. The link contains the “vtid” parameter (a short version of the contactId, also know as short GUID)
The tracking script will automatically store the “vtid” in the “_vaI” cookie
Identification on site
Identification should be done whenever possible. You should start out by mapping your current contact's integration towards Voyado and add the “setContactId” method every time you identify, update or create a contact.
Common examples are:
A contact registers as newsletter subscriber
A contact registers for loyalty program
A contact logs in
A contact completes a purchase
A contact uses a soft identification
Best practices about cookies and identification
From when a contact is identified, all upcoming tracking events from the same browser are linked to them. This applies until the _vaI cookie disappears or changes (for example, when another user logs into the site from the same browser). We recommend that the e-com always includes the contactId in all tracking events such as cart() and productview().
Regardless of whether the contact is identified or not, all tracking events are always linked to a client ID stored in the _va cookie. A browser retains the same client ID until the cookie disappears. By mapping client ID to contact ID, Engage can then link historical tracking events to that contact.
So, since anonymous tracking events can be linked to a contact ID afterwards, the e-com site should not limit tracking events to only identified or logged-in users.
List of relevant cookies
Name | Content | Example | Life span* |
_va | Client ID. Generated by the script and links all events to a specific contact. | VA671.1135834162 | 2 years |
_vaS | Session ID. Can be used to link events to a specific session. | VA671.234359421 | 30 minutes |
_vaI | Contact ID (guid/shortguid). If the contact is identified in Engage this links events to them. | a8tPsy8eqUm-yKoeAMPv7Q | 2 years |
*In Safari, the lifespan of all cookies created with javascript is a maximum of 7 days.
Important to remember during implementation
Call setContactId() only when the user is identified by the site.
As soon as the site knows who the user is (for instance after login), setContactId() must be called with the user’s contactId. Likewise, when using the soft identification in links to sites implementing the tracking script, make sure to set the contactId from the decrypted eClub query parameter. The function should never be called with zero, empty (no value) or other invalid value, as this could potentially reset an existing identification.