Verification and common issues
Here's how to deal with a few common situations and issues connected to web tracking.
Verifying that the tracking script is working
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 aren’t logged in/identified look for a _va cookie.
Tracking script implementation checklist
Verify that the tracking script is also loaded on non-product pages, such as the landing page.
If an email link leads to a page that does not have the tracking script, the contact identification could fail.
Verify that no empty events are sent on page load/page navigation.
Verify that events are sent when you are anonymous and that the cookie does not exist.
Engage can connect anonymous events to a user after they have been identified.
Verify that events are sent when a contact is identified via an email link and that the _vaI cookie is set correctly.
The user can be identified without being logged in.
Verify that events are sent when you are identified via login and that the _vaI cookie is set correctly.
When the user identifies himself via login, the site must set the _vaI cookie with the setContactId() function. Verify that events are sent when you are identified via login and that the _vaI cookie is set correctly. When the user identifies themselves via login, the site must set the _vaI cookie with the setContactId() function.
Verify that the cookie _vaI is set correctly with and without a trailing slash in the URL.
Test with the slash: www.site.se/?vtid=LTq-P1eRKU2s8CWc5KPe5w
And without slash: www.site.se?vtid=LTq-P1eRKU2s8CWc5KPe5w
Navigate further into the site to verify that _vaI is not cleared.
Verify that the cookie _vaI is updated with a new vtid.
Try first setting vtid to "a4fa7a46-23b0-4523-b09c-5462053e7627" and then changing it to "3fbe3a2d-9157-4d29-acf0-259ce4a3dee7".
Verify that sessionid is set in the payload. The abandoned browse trigger will not work if this is not set.
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.
Product of interest implementation checklist
Make sure itemId matches SKU
In order to track if a purchase followed after the last product view, the itemId from the product view is matched against the SKU in the article registry that is included on the receipt.
Verify that sessionid is set in the payload. The abandoned browse trigger will not work if this is not set.
Verify that the same events are not sent multiple times
A product page should trigger a productview event for each itemId/SKU. If several productview events are triggered, they must be for different itemId/SKU.
Verify productview event when navigating to product page in different ways
There are usually different ways to navigate to a product page, for example via the landing page, checkout, another product page, the menu, the shopping cart. For sites that are built as SPAs, no full page loading is done, which can cause inconsistent functionality.
Verify tracking 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.
Cart tracking implementation checklist
Verify that cart events are sent with the correct language/locale.
A shopping cart must have a language/locale that matches a Product Feed and the language version of the site (if it is a multimarket site).
Verify cart event before checkout.
Try updating the shopping cart in different ways (add item, remove item, change quantity, emptying). Is the quantity updated when the same item is added for the second time? What happens when you remove the last item? There are usually different ways to update the shopping cart, e.g. on the product page, popup. Sites built as SPAs tend to have inconsistent functionality.
Verify cart event in checkout.
Try updating the shopping cart on the checkout page, since the functionality on the checkout page usually differs from the rest of the site. Is there a difference between when you change the quantity to zero and remove the item? What happens when all items are removed? Is it possible to add new items from checkout? Does it differ between with/without vtid?
Verify that no incorrect events are sent when entering and exiting checkout.
What happens when you go in and out of the checkout and update the shopping cart on "both" pages?
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).
Common implementation errors related to identification
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.
The _val cookie is not set when link in e-mail ends with slash (/).
Some websites remove (redirect/rewrite) the ending slash from URLs without the querystrings being preserved. This might cause _vaI to not be set if the link in an Engage e-mail contains an ending slash.
For example:
www.mysite.com/myproduct/?vtid=uaz2QuT9NEez_eAsr8hEeQ
might be changed to:
www.mysite.com/myproduct
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.