Web Tracking API

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Journey JavaScript SDK for version Current of Genesys Predictive Engagement.

Learn how to track visitor activity using an API.

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 Web Tracking API

The Web Tracking API lets you track what visitors do on your website. Tracking data is collected through a series of interactions occurring on your website such as pageviews, button clicks, and custom events. These interactions are grouped into visits and act as a container for the actions that a specific visitor takes on your website.

Visits do not have a predefined duration. Depending on your visitor, the visit may be a few seconds or a couple of hours long. A new visit is created when the visitor has been idle for 30 minutes or more, but they all are linked to the same visitor.

Obtain consent before tracking visitors

To achieve compliance with GDPR requirements, consider whether you need to obtain a visitor's consent before tracking their data. For more information on using Genesys Predictive Engagement in a GDPR-compliant manner, see GDPR.

To implement tracking after receiving consent, modify the tracking snippet so that the `ac('init')` and `ac('pageview')` are only called when consent is given, as shown in the following example:

  (a[o].q=a[o].q||[]).push(arguments)},a[o].l=1*new Date();u=t.createElement(c),
  })(window, document, 'script', 'https://apps.inindca.com/journey/sdk/js/web/v1/ac.js', 'ac');
if (consentGiven) {
// Call the ac('init') function to enable tracking  
  ac('init', 'a061a3fe-7a80-4b50-9d3b-df88c0f9efad', { region: 'use1' });

You are responsible for setting the value for the `consentGiven` variable based on the visitor's choice.

Enable web tracking

To enable Web tracking on your website, initialize the Tracking SDK and then call the pageview method when a visitor navigates to a new page.

Stop tracking when a visitor revokes consent

If a visitor revokes consent at any point, invoke the destroy command to stop tracking and remove all cookies, as shown in the following example.

// to disable tracking and delete Genesys Predictive Engagement cookies
Retrieved from "https://all.docs.genesys.com/ATC/Current/SDK/Web_tracking_API (2024-05-26 21:15:46)"
Comments or questions about this documentation? Contact us for support!