- Identification and cookies
- Abandoned carts
- Product views
Introductory concepts
Here are a list of the basic concepts in this area.1 - Identification and cookies
The foundation of web activity tracking is identification and cookies. A contact can be identified through the script in three ways:- An email link (sent from Engage) that takes them to the website.
- Being identified by the website by, for example, signing in, in which case the method setContactId() is called.
- Being identified by an exiting _vaI cookie, previously set by the Voyado script.
_va. All web activity on that browser will then be linked to that client ID via the cookie. When that 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. With this method, all web activity can be connected to a specific contact in Engage.
2 - Abandoned cart
The tracking script enables abandoned cart functionality. By registering every state of a user’s cart, Engage is able to receive information about cart abandonment and use this to trigger automations. How to get started:- Configure a product feed, read more here.
- Implement the tracking script, read more here.
- Track cart changes, read more here.)
Learn more about abandoned cart from a user's perspective.
3 - Abandoned browse
The tracking script enables abandoned browse functionality, in the same way as abandoned cart. The site sends product view and cart events to Engage through the tracking script (or the API if the user has been identified). Using this Engage can detect when a session is abandoned and nothing has been added to the cart and then trigger an automation. How to get started:- First implement everything for Abandoned cart (see above).
- Track product views, including locale. Read more here.
Learn more about abandoned browse from a user's perspective.
4 - Products of interest
By tracking which products a user interacts with, Engage can calculate a list of products of interest. This can then be used in, for example, segmentations. This data will also be a part of the algorithm that calculates Engage’s product recommendations.- Configure a product feed, read more here.
- Implement the tracking script read more here.
- Track product views, read more here.
5 - The sessionId
ThesessionId value is unique for every session. When using the tracking script, this is included automatically in the data sent. However, if you are using the API to handle web activity tracking, the sessionId needs to be manually added to the payload that you send.
Engage will check if “cart” and “productView” events are using the same sessionId. If they are, then only the Abandoned Cart automation in Engage will be triggered. The Abandoned Browse automation will only get triggered if there are no cart events registered during the session that has that specific sessionId.
6 - Collect endpoint
The Collect endpoint is the URL called when the cart/productView/emptyCart method is invoked and it is used to send updates for cart content and product views. This is not one of the Engage API endpoints used for integration, but a different endpoint used by the Voyado tracking script.The tracking script
A tracking script allows you to gather behavioral data such as cart changes and product views from website visitors. It consists of a small snippet of code, usually as JavaScript, placed in the HTML source code of a website. The tracking script is required for using features like abandoned cart and products of interest. The tracking script should not be confused with any tracking parameters attached to the URL. Once the script is implemented it will generate a unique client ID and store it in a first-party cookie named_va. All web activity on that browser is then linked to that client ID via the cookie. When that user clicks on a link in an email from Engage, the tracking script reads the contact ID (vtid) from the URL and stores it in a cookie named _vaI. With this method, web activities can be connected to a specific contact in Engage.
Configuring the tracking script
This is the Voyado tracking script:[SCRIPT-PATH]
[SCRIPT-PATH]
- For the production environment, change [SCRIPT-PATH] to:
- For the staging environment [SCRIPT-PATH] will be:
[TENANT-ID]
[TENANT-ID]
Implementing the tracking script
The tracking script can now be placed as it is (implemented in code) on your website, or it can be implemented in these two ways:Tracking script implemented in code
Tracking script implemented in code
Tracking script implemented via a tag manager
Tracking script implemented via a tag manager
- Log into your Tag Manager
- Select “New Tag”
- Name your tag something easily recognizable
- Open “Tag configuration” and select “Custom HTML” as tag type
- Copy and paste your configured tracking script into the box
- Open ”Triggers” and select the trigger “All pages” (recommended)
- Save your tag
- Publish the new version of your tag container
Show me how to implement server-side cookies
Identification and cookies
Identification in this sense means linking a user browsing the site to a contact ID in Engage. As a user interacts with the site, their activity is saved in a first-party cookie. This happens whether they have already been identified or not. When they are identified, those anonymous tracking events can then be linked to a contact ID. This means the e-com site should not limit tracking events such as cart() and productview() to only identified or logged-in users. Once a user is identified, it’s then possible to build an understanding of their behavior on the site, using the data saved in cookies. This can be used, for example, to offer them a personalized experience and more relevant communication. All upcoming tracking events from the same browser are then linked to that user. This applies until the first-party cookie disappears or changes (for example, when another user logs into the site from the same browser). Common situations when a user can be identified is when they:- Register as a newsletter subscriber
- Register for a loyalty program
- Log into the site
- Complete a purchase
- Use soft identification
See how soft identification works
Using setContactId()
As soon as a visitor is identified by the site thesetContactId() method should be invoked with their unique contactId value:
Browser cookies
There are two cookies involved here:The _va cookie
The _va cookie
The _vaI cookie
The _vaI cookie
Server-side cookies
The cookie_vaI (which stores the contactId) is created client-side by the script. With Apple ITP (Intelligent Tracking Prevention) all client-side cookies (and LocalStorage) have a capped lifetime of 7 days in Safari. Which means that when an identified visitor doesn’t revisit the site within 7 days, the cookie will expire and the script won’t be able to identify the visitor using the _vaI cookie.
This cookie lifetime cap applies only to cookies created client-side (with Safari) and doesn’t affect server-side created cookies.
The tracking script supports copying the value from a cookie _vaI_server that was created server-side as a fallback, which can be used to recreate the client-side cookie _vaI.
The cookie _vaI will be recreated:
- When the site invokes setContactId() or includes
contactIdin an event - If the URL param
vtidexists - If the LocalStorage key
vtidexists - If the cookie
_vaI_serverexists
_vaI_server identified visitors will stay identified when returning even after 7 days have passed.
To implement this, the site (server-side) should check if the request includes a_vaI cookie. If so, the site should copy the value to a new cookie _vaI_server, give it a 1-year expiration date, and add it to the response.

Tracking cart changes
Cart changes can be tracked either with the Voyado Engage tracking script or the tracking API. Engage can trigger abandoned cart communication to be sent to identified contacts. To enable this, Engage needs to know:- Every update of every unique shopping cart
- The
contactIdof the visitor
- cart(): Used for registering visitor actions related to any cart modification
- emptyCart(): Used for pruning the cart of all items, usually when indicating a purchase or logout by the e-com visitor
The data flow
This is how the flow looks:- The site submits shopping cart changes, either via the tracking script implemented on the e-com site or through the tracking API.
- Carts containing products that haven’t been accessed for at least 30 minutes are considered abandoned. If the cart is connected to a specific contact it will be sent to Engage. All other carts will be filtered out.
- Engage then triggers the relevant automation (based on language/locale).
Cart automation requirements
The following are required so that an abaondoned cart automation can be triggered:- The locale must match a product feed in Engage and the corresponding language must be set in an automation.
- The SKU/SKUs must match products in the product feed (commonly “g:id”). If a SKU doesn’t match the feed, that particular product will not be included in the email. If no SKUs match the products in the feed the automation won’t be triggered at all.
- No products in the cart have been purchased (meaning no transaction has been sent to Engage) since the cart was identified as abandoned (although this can be overruled when configuring the trigger).
Using the tracking script
Here is how to use the tracking script to track cart changes.The cart() method
The cart() method
The emptyCart() method
The emptyCart() method
Using the tracking API
It’s possible to submit cart changes directly via the API instead of implementing the tracking script. If you choose this approach, it is important to identify all contacts that come to the e-com via links in emails (add “vtid” in “contactId”). The calls can be tested through your OpenAPI (Swagger) page.Read about the Engage API and your OpenAPI page
When tracking cart changes
Those points are important to remember when tracking cart changes:- All behavioral data can be used to build understanding and insights. A shopping cart belonging to an anonymous user can still be linked to a contact after they are identified.
- If the user is **identified / logged in, **both the “cart()” script method and the Carts API can be used to track their behavior. For anonymous users, however, only the “cart()” script can be used. This is because the tracking API always requires the contactId.
- For cart updates, call the “cart()” script method (for identified and anonymous users) or the Carts API (for identified users only) for all updates to the shopping cart, regardless of where on the site or at what stage the cart update takes place (product page, popup or checkout). Engage handles the shopping cart based on its latest change. It is therefore important that all changes generate a call to “cart()” or the Carts API and that the data corresponds to the shopping cart currently displayed on the website.
- The “cartRef” value must be unique and must not be shared between different baskets or users. A “cartRef” of a specific shopping cart must not be changed, and all updates regarding a shopping cart must use the same “cartRef” value.
- For empty carts, use “cartRef” as well. Even empty carts need a cart reference.
- Call the “cart()” script method or Carts API with a “locale” value corresponding to the locale of your Product Feed in Engage. In order to enrich the products with article data, a Product Feed for that locale needs to be set up in Engage. An automation using that locale also needs to be active.
- All carts not emptied before the website visitor leaves, or makes a purchase, risk being marked as abandoned. If you have an abandoned cart automation active, that automation will then be triggered by those unemptied carts.
Tracking product views
By tracking product views, Engage can:- Trigger abandoned browse automations
- Build audiences based on products of interest
- Get improved product recommendations
- Using the Voyado tracking script
- Using the tracking API
- Abandoned browse
- Products of interest
- Product recommendations
Abandoned browse
Abandoned browse
- The site submits product views, which are part of a session, either via the tracking script implemented on the e-com site or through the tracking API.
- Sessions without activity for at least 30 minutes are considered abandoned. If the session doesn’t contain any cart event, and the product views are connected to a specific contact, it will be sent to Engage. All other sessions will be filtered out. A session can only be sent to Engage once.
- All product views sent to Engage are enriched with data from the product feed.
- Engage then triggers the relevant automation, based on the specific trigger configurations. If automations contain email activities those can include dynamic product data enriched from the product feed.
Read more about abandoned browse here.
Products of interest
Products of interest
- The site submits product views, which are part of a session, either via the tracking script implemented on the e-com site or through the tracking API.
- Engage, using the recency, frequency and other patterns of product views from the last 90 days, calculates up to 25 products which each contact is probably most interested in, based only on their onsite behaviour.
- These products are updated using a scheduled job and enriched by the article registry and can then be used in segmentation and as part of a scheduled selection in an automation.
Read more about products of interest here.
Product recommendations
Product recommendations
Abandoned browse automations
The following are required so that an abandoned browse automation can be triggered:- The locale must match a product feed in Engage. Events without a matching product feed will be filtered out.
- The SKUs must match products in the product feed (commonly “g:id”). If an SKU doesn’t match the feed, that particular product will not be included in the email. If no SKUs match the products in the feed, the automation won’t be triggered at all.
Using the tracking script
The tracking script to track product views works via the productview() method. Invoke this method every time a product is viewed, such as on a product page, whether the user has been identified by the website or not.- Call productview() in all cases, regardless of whether the user is identified or logged in or not. All behavioral data can be used for insights and a product view belonging to an anonymous user can be linked to a specific user after they are identified.
-
Call productview() for all product views and with an
itemIdthat matches SKU in Engage. A product view can be a visit to a product page but also anything else that shows a selected product to the user, for example a “quick look” in a popup. The product/itemId will be matched against the SKU in Engage and enriched with product and transaction data. A product page can call productview() multiple times if it represents multiple SKUs.
Using the tracking API
It’s possible to submit product views directly via the API instead of implementing the tracking script. Keep in mind, if doing things this way, that a lot of functionality that exists out-of-the-box when using the script has to now be handled directly by the retailer. It’s important to identify contacts that enter the e-com from a link in a newsletter by reading the encrypted JSON that is sent in the link’s query string. This contains the information needed to identify the contact. Only identified product views can be registered via API (since the contactId is required). A product view is part of a session, identified by itssessionId, which is required for abandoned browse. This is handled automatically by the tracking script, but when using the API the sessionId has to be included in the payload in all calls.
Read more about the Engage REST API here.
Web activity tracking use cases
Here are some use cases for web activity tracking:Visitor arriving via newsletter link
Visitor arriving via newsletter link
Visitor arriving unidentified
Visitor arriving unidentified
- Populate
categoryNamewith the current product category, for example:“categoryName”: ”Computer accessories \> Printers \> Toners”) - Populate
itemIdwith the current product SKU (e.g. “itemId”: “549852″) - Populate
localebased on the site’s current language/market (e.g. “locale“: “sv-SE“) - Do NOT populate
contactId
Visitor arriving at product display page
Visitor arriving at product display page
- Avoid sending a productview for every size and instead send one when a specific size/colour/variant is picked
- If you want to track the view no matter the variant, then send a random SKU from the PDP. Or, as a last resort, send all variants. If all variants are sent, beware that you risk triggering abandoned browse emails containing many variants of the same product.
Verification and common issues
Here’s how to deal with a few common situations and issues connected to web tracking.1 - Verify tracking script
- Go to your e-com site.
- Open the JavaScript/developer console and go to “Sources”.
- Search for “analytics” and make sure you are using the latest script version.
- Go to “Application” → Cookies → the site that has implemented the tracking.
- If you are logged in/identified, look for the _val cookie
- If you are not logged in/identified then look for a _va cookie.
2 - Checklist - Tracking script
Go through these steps to verify your tracking script implementation.Tracking script on non-product pages
No empty events on page navigation
When user is anonymous
When user is identified
When user is logged in
Trailing slash in the URL
- Test with the slash: www.site.se/?vtid=LTq-P1eRKU2s8CWc5KPe5w
- Test without the slash: www.site.se?vtid=LTq-P1eRKU2s8CWc5KPe5w
- ALso navigate further into the site to verify that _vaI is not cleared.
Cookie _vaI is updated with a new vtid
Sessionid is set in the payload


3 - Verify tracking of product views
Here’s how to verify that tracking of your product views is working.- Go to your e-com site.
- Open the JavaScript/developer console, go to “Networks”, and select the Fetch/XHR tab.
- Visit any random product on the site.
- You should now see a call made to the Collect endpoint.
- In the payload, the te value should be your tenants/account name. Note that Locale does not have to be the same as the cart payload, and is not used in to identify anything.
- When viewing a product, the t (type) value should be “productview”, as pictured below.
- If you are logged in/identified, click on the payload and make sure the ci value is the same ID as in the _val cookie mentioned above. The value of ci should not be anything other than the ID.
4 - Checklist - Product of Interest
Make sure itemId matches SKU
Verify that sessionid is set in the payload
Verify that the same events are not sent multiple times
Verify productview event when navigating to product page in different ways

5 - Verifying cart changes


- Go to your e-com site.
- Open the JavaScript/developer console and go to “Networks” and select the Fetch/XHR tab.
- Place an item in the cart.
- You should now see a call made to an endpoint named Collect.
- In the payload, the t (type) value should be “cart”. Note the items[] array which may include products you’ve placed in your cart.
- If possible, complete the purchase / check out the cart.
- At this point a new Collect event should be fired with an empty cart indicating that the purchase has been made.
6 - Checklist - Cart tracking
Go through these steps to verify your cart tracking.Check that cart events have correct language/locale
Check cart event before checkout
Verify cart event in checkout
7 - Common implementation errors
- Cart event is not sent for every update: Every update of the cart needs to generate a cart event to the Collect endpoint. This includes updates such as add/remove product, update quantity, empty cart. These updates can occur in different contexts (product page, cart popup/sidebar, checkout, etc) and function differently.
- Different cartRef for the same cart: The cartRef value must be unique per cart and have to stay persistent for all cart-events, it cannot change between updates. Invalid cartRef on remove product and empty cart are common problems.
- Multiple cart/productview events: Make sure that a cart update only generates a single cart event and that non-cart actions (e.g. page loads) don’t generate any additional cart events. A visit to a product page should not generate more than one productview event per unique SKU (multiple SKUs with corresponding events on a single product page is fine).
8 - Common identification errors
- Clearing the _vaI cookie when it is set with vtid: The _val cookie is set with vtid when the user is identified by e-mail. Do not invoke setContactId() with an invalid value (such as empty or null) when the user is not signed in, since the user might already be identified without being signed into the website.
- No cart/productview events before checkout or sign in: Do not limit cart/productview events only to the checkout page only, or only to signed in/identified users.
-
The _val cookie is not set when link in e-mail ends with slash (/): Some websites remove the ending slash from URLs without the query strings being preserved. This might cause _vaI to not be set if the link in an Engage e-mail contains an ending slash.
For examplewww.mysite.com/myproduct/?vtid=uaz2QuT9NEez_eAsr8hEeQmight be changed towww.mysite.com/myproduct.

