Skip to main content
The tracking script is a small JavaScript snippet placed in the HTML of your website. It collects cart changes and product views and sends them to Engage. The tracking script is required for:
  • abandoned cart
  • abandoned browse
  • products of interest
  • product recommendations
The tracking script is not the same thing as the tracking parameters attached to a URL. The script runs on your pages while the URL parameters (such as vtid) are read by the script.

Configure the script

This is the Voyado tracking script:
Replace these two placeholders before you use it:
The path to the JavaScript analytics package. There are two options, depending on the environment you are running in.
Production
Staging
Use the path that matches your environment. Running the production script in staging (or the other way round) means tracking will not work.
analytics_0.1.7 is the latest version. You can pin an earlier version if you need to, but note that server-side cookie support requires 0.1.7 or later.
Your unique client (tenant) ID. It is the same in production and staging, and is usually the subdomain in your Engage root URL.For example, if your URL is supershop.voyado.com, the tenant ID is supershop.Contact your Voyado Engage team if you are unsure.
A configured script looks like this:
Complete tracking script

Implement the script

The script must be present, initialized and running on every page of your site. including landing pages, category pages and other non-product pages. The script is what identifies a visitor who arrives from an Engage email link. If an email link lands on a page without the script, identification will fail.
Implement the script either directly in your page templates or through a tag manager.
Copy your configured snippet and paste it immediately after the <head> tag of every page on your website.
  1. Log into your tag manager.
  2. Select New Tag.
  3. Give the tag an easily recognizable name.
  4. Open Tag configuration and select Custom HTML as the tag type.
  5. Paste your configured tracking script into the box.
  6. Open Triggers and select All pages (recommended).
  7. Save the tag.
  8. Publish the new version of your tag container.

Script methods

Once the script is running, the following functions are available on your pages.
Even though you will see these referred to as functions, they are not actual functions in JavaScript. Instead, the va() function is called with two arguments: the function name as a string, and then the value / payload. For example:

setContactId() and cookies

cart() and emptyCart()

productview()

Improving identification in Safari

Safari caps the lifetime of cookies created with JavaScript at seven days. Script version 0.1.7 and later can fall back to a cookie your server creates, which keeps visitors identified for a year.

Implement server-side cookies