Skip to main content

Tracking manager

The tracking manager lets you track key customer actions like button clicks, product views, and add-to-cart events. You can define and adjust tracking rules in real time using a simple interface.

Easily sync your data with Google Analytics, Adobe Analytics, or custom BI dashboards to get deeper insights into return on investment and overall page performance.

To activate the tracking manager, please contact your Zoovu representative or send a message to the Customer Success Team

With tracking scripts, you can:

  • Track user actions, like add to cart, page visits, or purchases.
  • Set triggers to detect specific behaviors.
  • Define actions based on those triggers (e.g., send data when a button is clicked).
  • Use variables to capture dynamic information from the page.
  • Respect user privacy settings with consent tracking.

Create a tracking script

  • Go to Zoovu Home and navigate to "Tracking scripts".
  • Click on the "Scripts" tab.

Scripts

  • Select "Create tracking script".

All events tracked under this script will be linked to the specified domain.

Configure rules

Each tracking script consists of rules, which define:

  • WHEN a condition is met (Trigger)
  • THEN an action is performed (Action)

For example, you can track an "Add to Cart" event when a user clicks the "Add to Cart" button.

Setting conditions ("When")

The When section defines the trigger - the action that activates tracking.

  • Triggers evaluate to true or false to determine if the rule should run.
  • They can listen for clicks, page loads, or other events.
Example trigger setup: Track an Add to Cart event when a user clicks the Add to Cart button.
VariableOperatorValue
Page URLcontains&productId=
Event targetmatches

Defining actions ("Then")

The Then section defines what happens when the trigger is activated.

  • Actions can be predefined events (e.g. "Add to Cart") or custom actions.
  • If a standard event is selected, it will be sent to the tracking system.
Example:
  • Trigger: A user clicks the "Add to Cart" button.
  • Action: Send an "Add to Cart" event to the tracking system.

Using variables

Variables dynamically capture data from a page before sending an event.

Variables can be:

  • Constants: Fixed values.
  • Functions: JavaScript snippets that extract values from the page.
Example: Extracting SKU for an "Add to Cart" event
const skuElement = document.querySelector('#product-details-sku');
const sku = skuElement.innerHTML;
return sku; // Retrieves the product SKU from the page
Example: Extracting SKU dynamically in a product list
const clickedProductContainer = event.target.parentElement;
const sku = clickedProductContainer.querySelector('#product-details-sku').innerHTML;
return sku; // Retrieves SKU from the clicked product in a list view

The function must return a value matching the expected type (TEXT, NUMBER, etc.).

Variable types and configuration

When creating variables, you need to specify both the variable type and return type:

Variable types

  • Function: Dynamic code that computes values from the page
  • Constant: Static values that never change

Return types

Variables must specify what type of data they return:

  • TEXT: String values (e.g., product SKU, user ID)
  • NUMBER: Numeric values (e.g., price, quantity)
  • BOOLEAN: True/false values
  • LIST: Array of values

Type matching requirements

The value returned by your variable code must match the selected return type:

// For TEXT return type - make sure to return a string
const sku = document.querySelector('#product-sku').innerHTML;
return sku; // Returns string

// For NUMBER return type - ensure numeric value
const price = parseFloat(document.querySelector('#price').textContent);
return price; // Returns number

If the returned value doesn't match the expected type, the rule won't execute and an error message will appear in the console.

Default variables

Some commonly used variables are predefined and available by default:

  • Current page URL
  • Event target (the element that triggered the event)
  • Event target's parent element

Configuring triggers

Triggers define when an action is executed:

  • Click triggers: Fire when a user clicks an element (e.g. a button).
  • Page load triggers: Fire when a page loads or when the URL changes.
  • AND/OR conditions: Combine multiple conditions to refine when a rule is activated.

Tracking events in Single Page Applications (SPAs)

Single Page Applications (SPAs) don’t reload the page when users navigate, so standard page load triggers won’t work. Instead, tracking scripts monitor URL changes to detect when a new page is displayed.

For example:

If a user moves from /products/123 to /cart, the script detects the URL change and logs an event.

Custom actions

Custom actions allow for advanced tracking scenarios beyond predefined events.

Example: Storing purchased products across pages

  • Store product details in localStorage after checkout.
  • Retrieve this data on the Thank You page using a variable.

Custom actions, like variables, have access to the trigger’s event object.

Advanced mode (custom JavaScript execution)

Use only when necessary — this is meant for special cases where standard tracking options aren't enough. Code in Advanced Mode runs before all rules and executes on every page.

Save, publish, and integrate tracking scripts

After configuring your script, click Publish. Once published, all updates apply automatically when the script runs on your site.

Integrating the tracking script

  • Click Generate Integration Code.
  • Copy the JavaScript snippet.
  • Paste it into your website before the closing </head> tag on every page where you want tracking to work (including cart and checkout pages).

Once integrated, future updates apply automatically — no need to edit the code again.

Development and testing integration

For development and testing purposes, you can temporarily inject the tracking script using a browser plugin without waiting for permanent website integration:

  1. Copy the src URL from your integration code:

    https://e-commerce-health-dashboard.zoovu.com/user-tracking-script/[your-script-id]/js-loader
  2. Use a browser plugin to inject the script. Create this code snippet:

    let scr = document.createElement('script');
    scr.setAttribute('src', 'your-src-url-here');
    document.head.appendChild(scr);
  3. Run the code on your target website using the browser plugin

This method allows you to test your tracking rules immediately and see changes live without waiting for customer integration.

The integration tag remains the same between publishes - once generated, it never changes. You don't need to update the integration code when publishing new versions of your script.

Verify script integration

To confirm your script is running:

  1. Open browser Developer Tools (F12)
  2. Go to the Network tab
  3. Search for "zoovu" in the filter
  4. Look for requests starting with https://e-commerce-health-dashboard.zoovu.com/
  5. If you see the js-loader request, your script is integrated correctly

Debugging tracking scripts

If your tracking script isn’t working as expected, you can use browser developer tools to check whether events are being tracked correctly.

Checking network requests

  • In your browser, open the Developer Tools (DevTools). In Chrome, press F12 or right-click anywhere on the page and select Inspect.
  • Go to the Network tab to see all network requests made by your webpage, including those sent by your tracking script.
  • In the filter bar, type /fact to find requests related to tracking events.
  • Click on a request to see the details. Look at the payload to check if the correct event details are being sent.

Viewing error messages

By default, tracking script errors are not displayed in the browser console. If the script isn’t working, enable Verbose Mode in DevTools to see debug messages:

  • Open Developer Tools and go to the Console tab.
  • Click the Filter settings and select Verbose to display detailed logs.
  • Look for any error messages related to tracking and check for incorrect values or missing data.

Available script API

When writing custom actions or variables, you can use these API methods:

NameTypeAvailabilityDescription
eventObjectVariables, Custom ActionsEvent issued by the trigger
disableTracking()FunctionVariables, Custom Actions, Advanced ModeDisables tracking
enableTracking()FunctionVariables, Custom Actions, Advanced ModeEnables tracking
getNumericPriceFromString()FunctionVariables, Custom ActionsReturns the value as number: 1113.33

Copy a tracking script

You can duplicate an existing script to create variations or test setups:

  • In the Scripts tab, select the script you want to copy.
  • Click the duplicate/copy option.
  • Choose the same domain or assign a different domain.
  • The copy includes all rules but references the same triggers and variables.

The tracking script uses the same zoovu-cid cookie as other Zoovu products. If a cookie already exists from other Zoovu experiences, it will reuse that cookie.

Compliance requirements

  • Users must be able to opt-in or opt-out based on your legal requirements to ensure compliance with GDPR and privacy regulations.
  • Implement proper consent mechanisms for your region (opt-in vs opt-out approaches).
  • The DECLINE_TRACKING event logs users who refuse tracking and automatically disables tracking.

Disabling tracking

By default, tracking is enabled. You can disable it when users don't provide consent:

  • Use the disableTracking() function in custom actions or advanced mode.
  • Send the DECLINE_TRACKING event (automatically calls disableTracking()).
  • Tracking can be re-enabled at any time with enableTracking().