> ## 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.

# Web activity tracking

> How Engage collects shopping cart and product view data from your website, and what that data is used for.

Web activity tracking sends two kinds of behavioral data from your website to Engage: **shopping cart changes** and **product views**. Engage links that data to a contact, either immediately or later once the visitor is identified, and uses it to trigger automations and personalize communication.

Visitor activity is tracked whether or not they are identified. Anonymous activity is stored in the browser and connected to a contact as soon as that visitor is identified.

## What it enables

| Feature                                                                                          | What it needs                                                                                           |
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
| **Abandoned cart** — trigger an automation when a cart is left behind                            | A product feed, the tracking script, and [cart tracking](/docs/tracking/tracking-cart-changes)          |
| **Abandoned browse** — trigger an automation when a visitor browses but adds nothing to the cart | Everything for abandoned cart, plus [product view tracking](/docs/tracking/tracking-product-views)      |
| **Products of interest** — a per-contact list of up to 25 products, usable in segmentation       | A product feed, the tracking script, and [product view tracking](/docs/tracking/tracking-product-views) |
| **Product recommendations** — personalized recommendations in emails                             | Products of interest, which are combined with purchase and return history                               |

<Card title="More about abandoned cart and abandoned browse" href="https://help.engage.voyado.com/hc/en-gb/sections/17212833070492-Abandoned-cart" icon="https://mintcdn.com/voyado/Ns4bBcK3LNctK_Un/icons/help-center-link.png?fit=max&auto=format&n=Ns4bBcK3LNctK_Un&q=85&s=3e7ca2ce0b8cfb9fbd27a4bdf53b2ce1" horizontal width="128" height="128" data-path="icons/help-center-link.png" />

## How the data reaches Engage

1. Your site calls a tracking method (`cart()`, `emptyCart()` or `productview()`) whenever the visitor changes their cart or views a product.
2. The method sends an HTTP POST to the **Collect endpoint**.
3. Engage waits for the cart or session to go quiet for 30 minutes, then treats it as abandoned.
4. If the activity is connected to a contact, Engage enriches it with data from the product feed and triggers the matching automation. Activity still not connected to any contact at that point is filtered out.

## Two ways to send the data

The two ways of implementing tracking are:

* With the tracking script
* With the tracking API

Almost all implementations use the *tracking script*. However the tracking API also exists for cases where a script can't be used, but this shifts more of the work onto you.

|                                                | Tracking script                          | Tracking API                                    |
| ---------------------------------------------- | ---------------------------------------- | ----------------------------------------------- |
| Anonymous visitors                             | Tracked                                  | **Not possible** — `contactId` is required      |
| Identified visitors                            | Tracked                                  | Tracked                                         |
| `sessionId`                                    | Added automatically                      | You must add it to every payload                |
| Cookies and identification                     | Handled by the script                    | You must handle it yourself                     |
| Identifying visitors arriving from email links | Automatic, from the `vtid` URL parameter | You must read `vtid` and pass it as `contactId` |

## Key terms

| Term             | What it means                                                                                                                  |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Client ID        | An ID the script generates to represent a **browser**. Stored in the `_va` cookie.                                             |
| Contact ID       | The Engage ID of an **identified contact**. Stored in the `_vaI` cookie.                                                       |
| `vtid`           | A query parameter added to links in Engage emails. Holds the contact ID in encoded form.                                       |
| `sessionId`      | A unique ID for one browsing session. Engage uses it to decide whether abandoned cart or abandoned browse should trigger.      |
| Collect endpoint | The endpoint the tracking script posts to. It is **not** part of the Engage REST API — it is used only by the tracking script. |
| `cartRef`        | Your own unique reference for one shopping cart. It must stay the same for that cart's entire life.                            |
| `itemId`         | The product identifier you send. Matched against the SKU in Engage.                                                            |
| `locale`         | The language/market of the site, as an IETF language tag such as `sv-SE`. Must match a product feed in Engage.                 |

<Tip>
  `_vaI` is `_va` followed by an uppercase letter **I** (I as in Ingemar), not a lowercase L. The two are hard to tell apart in many fonts.
</Tip>

## Where to start

<Steps>
  <Step title="Configure a product feed in Engage">
    Cart and product view data is enriched from the product feed. Without a feed for the relevant locale, no automation can trigger.

    <Card title="Set up a product feed" href="/docs/setup/product-feeds" 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" />
  </Step>

  <Step title="Implement the tracking script">
    One snippet, on every page of the site.

    <Card title="The tracking script" href="/docs/tracking/tracking-script" 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" />
  </Step>

  <Step title="Identify your visitors">
    Call `setContactId()` at the moment your site identifies someone, and understand how the cookies work.

    <Card title="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" />
  </Step>

  <Step title="Send cart and product view events">
    Track every cart change, and every product view.

    <Card title="Tracking cart changes" href="/docs/tracking/tracking-cart-changes" 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" />

    <Card title="Tracking product views" href="/docs/tracking/tracking-product-views" 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" />
  </Step>

  <Step title="Verify the implementation">
    Work through the checklists before going live.

    <Card title="Verifying and troubleshooting" href="/docs/tracking/verifying-web-tracking" 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" />
  </Step>
</Steps>
