> ## Documentation Index
> Fetch the complete documentation index at: https://developer.voyado.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Verifying and troubleshooting web tracking

> Step-by-step checks for the tracking script, cart events and product views, plus the most common implementation and identification errors.

Work through these checks before going live, and return to them when tracking data looks wrong in Engage.

## Verify the script and cookies

1. Go to your e-com site.
2. Open the developer console and go to **Sources**.
3. Search for `analytics` and confirm you are loading the expected script version, and the right one for your environment.
4. Go to **Application → Cookies** and select the site running the tracking.
5. If you are identified or logged in, look for the `_vaI` cookie.
6. If you are not identified, look for the `_va` cookie.

<Frame caption="The _vaI cookie">
  <img src="https://mintcdn.com/voyado/8kOOjKQnKrkLA-_G/images/web-activity-tracking/web-activity-tracking-02.png?fit=max&auto=format&n=8kOOjKQnKrkLA-_G&q=85&s=140d12d672ca8d44636ace32792b0117" alt="The _vaI cookie" width="1600" height="1031" data-path="images/web-activity-tracking/web-activity-tracking-02.png" />
</Frame>

<Frame caption="Tracking script used">
  <img src="https://mintcdn.com/voyado/8kOOjKQnKrkLA-_G/images/web-activity-tracking/web-activity-tracking-03.png?fit=max&auto=format&n=8kOOjKQnKrkLA-_G&q=85&s=caea41d4ea1721b9f9c0cbe1268a809a" alt="Tracking script used" width="1598" height="844" data-path="images/web-activity-tracking/web-activity-tracking-03.png" />
</Frame>

## Verify product views

1. Go to your e-com site.
2. Open the developer console, go to **Network** and select the **Fetch/XHR** tab.
3. Visit any product on the site.
4. You should see a call to the Collect endpoint.
5. In the payload, `te` should be your tenant/account name.
6. `t` (type) should be `productview`.
7. If you are identified, check that `ci` holds the same ID as the `_vaI` cookie — and nothing else.

<Note>
  The `locale` in a product view payload does not have to match the locale in your cart payloads, and it is not used to identify anything. It does, however, need to match a product feed for abandoned browse to trigger.
</Note>

<Frame caption="Finding the payload">
  <img src="https://mintcdn.com/voyado/8kOOjKQnKrkLA-_G/images/web-activity-tracking/web-activity-tracking-04.png?fit=max&auto=format&n=8kOOjKQnKrkLA-_G&q=85&s=4ec2a2e89ee46ea6e8740668245069d6" alt="Finding the payload" width="1598" height="784" data-path="images/web-activity-tracking/web-activity-tracking-04.png" />
</Frame>

## Verify cart changes

1. Go to your e-com site.
2. Open the developer console, go to **Network** and select the **Fetch/XHR** tab.
3. Place an item in the cart.
4. You should see a call to the Collect endpoint.
5. In the payload, `t` (type) should be `cart`. Check the `items[]` array against what's actually in your cart.
6. If possible, complete the purchase.
7. A new Collect event should fire with an empty cart, confirming the purchase was registered.

<Frame caption="Verify tracking cart changes">
  <img src="https://mintcdn.com/voyado/8kOOjKQnKrkLA-_G/images/web-activity-tracking/web-activity-tracking-05.png?fit=max&auto=format&n=8kOOjKQnKrkLA-_G&q=85&s=883f395431d122acc77d4adb279a4d38" alt="Verify tracking cart changes 1" width="1600" height="787" data-path="images/web-activity-tracking/web-activity-tracking-05.png" />
</Frame>

<Frame caption="Verify tracking cart changes">
  <img src="https://mintcdn.com/voyado/8kOOjKQnKrkLA-_G/images/web-activity-tracking/web-activity-tracking-06.png?fit=max&auto=format&n=8kOOjKQnKrkLA-_G&q=85&s=d0e992ba9cee78248b0cdaa174abf2b5" alt="Verify tracking cart changes 2" width="1600" height="842" data-path="images/web-activity-tracking/web-activity-tracking-06.png" />
</Frame>

## Checklist: script and identification

<Steps>
  <Step title="The script loads on non-product pages">
    The script must load on landing pages, category pages and any other non-product page. If an email link lands on a page without the script, identification fails.
  </Step>

  <Step title="No empty events on page load or navigation">
    Confirm that simply loading or navigating between pages sends no events.
  </Step>

  <Step title="Events are sent for anonymous visitors">
    Events should be sent when no `_vaI` cookie exists. Engage connects anonymous events to a contact once they are identified.
  </Step>

  <Step title="Email-link identification works">
    Arrive via an email link and confirm events are sent and `_vaI` is set correctly. A visitor can be identified without being logged in.
  </Step>

  <Step title="Login identification works">
    Log in and confirm that `setContactId()` sets `_vaI` correctly and that events are sent with the identification in place.
  </Step>

  <Step title="Trailing slashes don't break identification">
    `_vaI` should be set whether or not the URL has a trailing slash.

    * With: `www.site.se/?vtid=LTq-P1eRKU2s8CWc5KPe5w`
    * Without: `www.site.se?vtid=LTq-P1eRKU2s8CWc5KPe5w`

    Then navigate further into the site and confirm `_vaI` is not cleared.
  </Step>

  <Step title="A new vtid overwrites the old one">
    `_vaI` should update when a different `vtid` is used. Set `vtid` to `a4fa7a46-23b0-4523-b09c-5462053e7627`, then change it to `3fbe3a2d-9157-4d29-acf0-259ce4a3dee7` and confirm the cookie follows.
  </Step>

  <Step title="sessionId is present in the payload">
    Abandoned browse will not trigger without it. The script adds it automatically; if you use the tracking API, you must add it yourself.
  </Step>

  <Step title="The script matches the environment">
    Running the production script in staging, or the staging script in production, means no tracking at all.
  </Step>
</Steps>

## Checklist: cart tracking

<Steps>
  <Step title="Cart events carry the correct locale">
    The cart's locale must match both a product feed in Engage and the language version of the site, if you run a multimarket site.
  </Step>

  <Step title="Cart updates outside checkout">
    Try every way of changing the cart: add an item, remove an item, change quantity, empty it. Does the quantity update when the same item is added a second time? What happens when you remove the last item? Carts can usually be updated from the product page and a popup as well — and sites built as SPAs tend to behave inconsistently.
  </Step>

  <Step title="Cart updates inside checkout">
    Checkout usually behaves differently from the rest of the site. Is there a difference between setting quantity to zero and removing the item? What happens when all items are removed? Can you add new items from checkout? Does any of it differ with and without `vtid`?
  </Step>

  <Step title="Moving in and out of checkout">
    Update the cart on both the checkout page and elsewhere, moving back and forth. Confirm no incorrect or duplicate events are sent.
  </Step>

  <Step title="emptyCart() fires after a completed purchase">
    Without this, the cart stays populated in Engage and can trigger an abandoned cart email to someone who already bought.
  </Step>
</Steps>

## Checklist: product views and products of interest

<Steps>
  <Step title="itemId matches the SKU in the article register">
    To detect whether a purchase followed a product view, Engage matches the `itemId` from the view against the SKU in the article register on the receipt.
  </Step>

  <Step title="No duplicate events for the same SKU">
    A product page should fire one `productview` per unique `itemId`/SKU. Several events on one page are fine only if they are for different SKUs.
  </Step>

  <Step title="Product views fire however the page is reached">
    Product pages can be reached from the landing page, checkout, another product page, the menu or the cart. Test each route. Sites built as SPAs don't do full page loads, which frequently causes events to be missed.
  </Step>
</Steps>

## Common implementation errors

* **A cart event isn't sent for every update.** Every change — add, remove, quantity change, empty — must generate a cart event to the Collect endpoint. These changes happen in different contexts (product page, cart popup or sidebar, checkout) that often behave differently.

* **The `cartRef` changes for the same cart.** `cartRef` must be unique per cart and identical across all of that cart's events. Invalid or changed `cartRef` values on remove-product and empty-cart events are a frequent cause of missing abandoned cart emails.

* **Duplicate cart or product view events.** One cart update should produce exactly one cart event, and actions that aren't cart updates (such as page loads) should produce none. A product page should produce no more than one `productview` per unique SKU.

## Common identification errors

* **The `_vaI` cookie is cleared after being set by `vtid`.** A visitor identified by an email link is identified without being signed in. Calling `setContactId()` with an empty or null value in that state wipes the identification. Only call it when your site has actually identified someone.

* **No cart or product view events before checkout or sign-in.** Don't limit events to the checkout page, or to signed-in visitors. Anonymous events are connected retroactively.

* **`_vaI` isn't set when the email link ends in a slash.** Some websites strip trailing slashes without preserving the query string, so `vtid` is lost. For example `www.mysite.com/myproduct/?vtid=uaz2QuT9NEez_eAsr8hEeQ` becomes `www.mysite.com/myproduct`.

<Card title="Read more about identification and cookies" href="/docs/tracking/identification-and-cookies" icon="https://mintcdn.com/voyado/Ns4bBcK3LNctK_Un/icons/developer-link.png?fit=max&auto=format&n=Ns4bBcK3LNctK_Un&q=85&s=fbd08f956358ab12f664a7158e1a1399" horizontal width="128" height="128" data-path="icons/developer-link.png" />
