Use Google Tag Manager with Genesys Predictive Engagement

From Genesys Documentation
Jump to: navigation, search
This topic is part of the manual Event tracking with tag managers for version Current of Genesys Predictive Engagement.

Learn how to use Google Tag Manager to customize and deploy Genesys Predictive Engagement tracking on your website.


About the tracking snippets

Customers who want to use web chat must use 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 customers who want to use web messaging instead of web chat must use the Messenger snippet. This snippet deploys Predictive Engagement tracking on your website and also allows you to use the web messaging feature.

About Google Tag Manager

When you use Google Tag Manager to deploy Genesys Predictive Engagement tracking, Genesys Predictive Engagement tracks standard customer journey events including pageviews and form entries. You can also use Google Tag Manager's prebuilt tags, triggers, variables, to track other events that are specific to your webpage and business needs.

For more information about using Google Tag Manager, see Google's Tag Manager Help.

Deploy the Messenger snippet with Google Tag Manager

If you are a Genesys Cloud customer and want to use the new web messaging feature, these instructions apply to you. If not, see Deploy the Predictive Engagement tracking snippet with Google Tag Manager.

To deploy the Messenger snippet (available to Genesys Cloud customers only), complete these steps:

  1. In Genesys Cloud Admin under Message, click Messenger Deployments.
  2. Click the name of the Messenger deployment to deploy.
  3. In the Deploy your snippet section, click Copy to Clipboard.
  4. In Google Tag Manager, create a Custom HTML tag.
  5. Paste the snippet into the body of the Custom HTML tag.
  6. Enclose the JavaScript code with <script> tags. Ensure that you unescape the snippet code to remove the \n new line escaped characters.
  7. Save the tag.
  8. Select the All Pages trigger.
  9. Save the tag with a meaningful name, such as Messenger Tag.
  10. Click Submit and then click Publish. The tag publishes to all pages on your website.

For more information, see Deploy Messenger in the Genesys Cloud Resource Center.

Deploy the Predictive Engagement tracking snippet with Google Tag Manager

If you are a Genesys Cloud customer and want to use the new web messaging feature, these instructions don’t apply to you. Instead, see Deploy the Messenger snippet with Google Tag Manager.

This video shows you how to use Google Tag Manager to deploy the Genesys Predictive Engagement tracking snippet on your website.

To deploy the Predictive Engagement tracking snippet, complete these steps:

  1. In Google Tag Manager, create a new trigger and select DOM Ready as the type.
  2. Create a new tag and select Custom HTML for the type.
  3. Configure the tag to use the new DOM Ready trigger.
  4. In Genesys Predictive Engagement, copy the tracking snippet.
  5. In Google Tag Manager, paste the snippet in the new Custom HTML tag.
  6. Save your changes and publish your workspace.

Triggers

A trigger is a condition that defines when a tag must run. Google Tag Manager provides a collection of built-in triggers. You can also create your own trigger.

This example shows the Form Submission trigger, which launches when the visitor clicks Sign up to submit the form.

Tip
Track submission errors with the built-in Element Visibility trigger. If an error message appears on the page, you can assume that the form contains errors and take appropriate actions. You can also track field-related error messages the same way.

Example trigger: track when a visitor scrolls

This example shows how to use the Scroll Depth trigger to capture vertical and horizontal scrolling events on webpages.

  • This trigger can fire either on all webpages or on a subset of pages that match the conditions that you specify
  • Specify the vertical and horizontal scroll depths in either percent or pixels.
  • Separate multiple values with commas.
Important
The Enable this trigger on Window Load (gtm.load) option makes sense only when the whole content of the webpage loads.

Limitations

The trigger can run only once per webpage. You cannot reset it manually. If a page is not scrollable, the trigger always fires. To avoid the trigger always firing, wrap the tag with the following code:

if ($(document).height() > $(window).height()) { /* your tag code */ }

Example trigger: track how long a visitor stays on a page

This example shows how to define a trigger to track whether a webpage remains open for 3 seconds.

Example trigger: form submission error

The Element Visibility trigger fires when an element is shown on the page. It is useful to catch form submission errors (such as when a field validator error message appears.)

Tags

Tags are code snippets that Google Tag Manager injects into your website and runs when a trigger condition occurs. For more information about the built-in tags available with Google Tag Manager, see Custom tags.

Important
Google Tag Manager treats JavaScript function calls as regular HTML, which results in errors. To avoid these types of errors, be sure to use triggers and tags as they are intended. Namely, use a trigger when you want to call a function.
Tip
If you deployed the Predictive Engagement tracking snippet, you can invoke Journey JavaScript SDK methods from Google Tag Manager tags.

Example tag: sign-up button

This example shows a simple tag that triggers when the visitor clicks Sign up. It displays the form values in a modal window.

Suppress triggering a tag

To prevent a tag from triggering, use event.preventDefault() on a webpage element listener.

Debug

To run Google Tag Manager integration in debug mode, click Preview on your account page. Debug appears on the bottom right corner of each integrated page on your website.

Use the console to track all events on the webpage. You can see information such as which tags have or have not triggered, error messages, and values of the variables.

Debug3.png