Note: This article only applies to customers using web chat. If you are a Genesys Cloud CX customer, we encourage you to use the new web messaging feature to replace web chat.

About the tracking snippets

Customers who want to use web chat must deploy the Predictive Engagement tracking snippet. This snippet deploys Predictive Engagement tracking on your website and also allows you to use the web chat feature.
Genesys Cloud CX customers who want to use web messaging must deploy the Messenger snippet. This snippet deploys Predictive Engagement tracking on your website and also allows you to use the web messaging feature.
This article provides instructions for deploying the Predictive Engagement tracking snippet only.

Before you begin

Read about the type of data that Genesys Predictive Engagement tracks and how to ensure that you track visitor data in a regulatory-compliant manner. Understand the implications of using ad blocking software. Finally, learn how the tracking snippet works and the types of tracking snippets available.

Copy the snippet

Genesys Predictive Engagement provides a tracking snippet that you can copy and paste. Since you are logged in to Genesys Cloud CX, the tracking snippet already contains your organization ID and region.

  1. Determine which snippet to use.
  2. In Admin in Genesys Cloud CX, open the Global Settings page and then click the Tracking Snippet tab.
  3. Copy the tracking snippet.
  4. Paste the snippet. For more information about where to paste the snippet, see Deploy the snippet.

Ad blockers

Ad blockers are plug-ins or browser extensions that improve page load times and minimize questionable tracking. The majority of ad blockers tested with out-of-the-box settings do not interfere with Genesys Predictive Engagement's tracking capabilities. However, there are a couple considerations if you use uBlock Origin:

  • uBlock Origin disables Genesys Predictive Engagement's tracking web beacons; this effectively prevents Genesys Predictive Engagement's tracking capabilities.
  • uBlock Origin and uBlock Plus Adblocker block popular tag managers such as Adobe Tag Manager, Google Tag Manager, and more.
If you use a tag manager to manage JavaScript and tracking on your website, consider adding ad blocker detection to your site to notify visitors with detected ad blockers that they may be missing some important functionality. Also, instead of using a tag manager to deploy the Genesys Predictive Engagement tracking snippet, consider placing the tracking snippet directly in the body or header of your website.

Types of tracking snippets and recommendations

Website snippet

The Website snippet provides tracking support to traditional webpages that contain little or no dynamic content. Traditional websites load a new HTML page whenever the visitor navigates to a different URL. To provide tracking support to traditional webpages, the Website snippet calls ac('pageview') each time the web browser loads a new page.

SPA snippet

The SPA snippet can track activity on Single Page Applications (SPAs). SPAs load dynamic content on demand without requiring a hard reload of the HTML page. The SPA snippet can also track when visitors click relative links, which the Website snippet does not. The SPA snippet works on SPAs such as Angular, React, and Vue.js. For more information about the additional tracking options available with the SPA snippet, see autotrackURLChange.

Snippet recommendations

If you have this type of website…Use this snippet…
Not sureSPA
Mix of traditional and SPA pagesSPA
Traditional pages onlyWebsite

Deployment overview

Deployment of tracking snippet

  1. Copy the snippet.
  2. (Optional)Customize the snippet.
  3. Deploy the snippet.
  4. Verify that the snippet works.
  5. Configure web tracking.
Note: For more information about advanced chat routing, see Genesys Predictive Engagement with advanced chat routing.

(Optional) Customize how the snippet tracks activity

You can customize how the snippet tracks activity on your website.

Deploy the snippet

About deploying the snippet

  • Deploy the widgets transport above the location where you deploy the Genesys Predictive Engagement tracking snippet.
  • Deploy the Genesys Predictive Engagement tracking snippet on the main window of the website to track.
  • Paste the tracking snippet in the head section of the website template page before the closing tag.
  • Do not deploy the tracking snippet in an iframe.
  • The Genesys Predictive Engagement tracking snippet loads JavaScript asynchronously without slowing down page loading. For more information about how the tracking snippet works, see About the tracking snippet.

Deployment instructions

Note: Deploy the widgets transport transport above the location where you deploy the Genesys Predictive Engagement tracking snippet.
After you copy the snippet, do one of the following:
Note: uBlock and other ad blocking software is known to block tag managers, in which case the tracking snippet deployed through the tag manager would also be blocked. For more information, see Ad blockers.

Verify that the snippet works

After deploying the tracking snippet, use Live Now to verify that Genesys Predictive Engagement is tracking your website activity. You should see an update every 4-5 seconds.

Troubleshoot the snippet

If the tracking snippet does not work properly when you load your web pages, check the following:

  • Is the snippet on the correct page?
  • Is the snippet in the correct place in the page header?
  • Are the parameters defined correctly?
  • Are there any typos, missing characters, or extra white space?
  • Were any characters replaced with their printable equivalents?
  • Is the domain on the list of allowed domains?

For more suggestions, see about deploying the snippet.

Error reference

Error codeDescription
403 errorIs your domain in the list of allowed domains?
404 errorIs there extra white space in the snippet?

Note: In a URL, white space is encoded as %20.

Bad requestIs there extra white space in the snippet?

Note: In a URL, white space is encoded as %20.

Initialization errorAre there any of the following in the snippet:
  • Typos
  • Missing characters
  • Dashes and quotes in URLs replaced with printable equivalents

Call the tracking snippet

After the tracking snippet is on your webpages, call it using one of the following:

  • If you use the traditional snippet, call ac('init') to initialize the Journey JavaScript SDK. For more information, see init.
  • If you use the SPA snippet, use ac('load') to load the autotrackUrlChange module and initialize the Journey JavaScript SDK. For more information, see load and autotrackURLChange.

After you initialize the Journey JavaScript SDK, Predictive Engagement tracks pageview events when visitors arrive on your webpages. For more information, see Tracking methods.

Other tracking options

Web tracking

Use the Web tracking feature to specify the domains to track and configure web-related tracking settings.

Custom modules

Use a set of modules to enhance the functionality that the Journey JavaScript SDK provides.

Event tracking with tag managers

Use your tag manager to build custom tags and triggers that define how Predictive Engagement tracks activity on your website. For more information, see About event tracking with tag managers.

Domain and subdomain tracking with cookies

Use cookies to track domains and subdomains. For more information, see Cookies and Advanced tracking with cookies.