Tracking snippet
Contents
- 1 Overview
- 2 Before you begin
- 3 Ad blockers
- 4 Copy the snippet
- 5 Types of tracking snippets
- 6 Snippet recommendations
- 7 Customize how the snippet tracks activity (optional)
- 8 Deploy the snippet
- 9 Deployment notes
- 10 Deploy the snippet with a tag manager
- 11 Deploy the snippet manually
- 12 Verify that the snippet works
- 13 Troubleshoot the snippet
- 14 Error reference
Learn how to enable visitor tracking on your website.
Prerequisites
- Configure the following permissions in PureCloud:
- Journey > Settings > Edit, or View permissions
Overview
- Review Before you begin.
- Copy the snippet.
- Optionally customize the snippet.
- Deploy the snippet.
- Verify that the snippet works.
- Configure web tracking.
Before you begin
Before you deploy the Genesys Predictive Engagement tracking snippet be sure you understand:
- All about tracking with Genesys Predictive Engagement.
- How to deploy the tracking snippet to be compliant with General Data Protection Regulation (GDPR).
- The effect of ad blockers on Genesys Predictive Engagement.
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.
Copy the snippet
- Click Admin.
- Under Altocloud, click Tracking Snippet.
- To determine which snippet to use:
- Read about the types of snippets.
- Review the snippet recommendations.
- Read about the types of snippets.
- Use a text editor to copy the snippet.
Since you are logged in to PureCloud, the Genesys Predictive Engagement tracking snippet already contains your organization ID and Genesys region.
- Use a text editor to ensure a clean copy and paste. Other programs may insert or replace characters in the tracking snippet.
Types of tracking snippets
Genesys Predictive Engagement provides the following types of snippets:
- Website snippet
- Single Page Application (SPA) snippet
Website snippet
The Website snippet provides tracking support to traditional webpages that contain little or nodynamic content. Traditional websites load a new HTML page whenever the user navigates to a different URL. To provide tracking support to traditional webpages, the Website snippet calls ac('pageview') each time the a new page is loaded by the web browser.
<script>
(function(a,t,c,l,o,u,d){a['_genesysJourneySdk']=o;a[o]=a[o]||function(){
(a[o].q=a[o].q||[]).push(arguments)},a[o].l=1*new Date();u=t.createElement(c),
d=t.getElementsByTagName(c)[0];u.async=1;u.src=l;u.charset='utf-8';d.parentNode.insertBefore(u,d)
})(window, document, 'script', 'https://example.com, 'ac');
ac('init', 'a061a3fe-7a80-4b50-9d3b-df88c0f9efad', { region: 'use1' });
ac('pageview');
</script>
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 users click relative links, which the Website snippet does not. The SPA snippet works on SPAs such as Angular, React, Vue.js, and so on. For more information about the additional tracking options available with the SPA snippet, see [[ATC/Current/SDK/autoTrackURLChange|]].
<script>
(function(a,t,c,l,o,u,d){a['_genesysJourneySdk']=o;a[o]=a[o]||function(){
(a[o].q=a[o].q||[]).push(arguments)},a[o].l=1*new Date();u=t.createElement(c),
d=t.getElementsByTagName(c)[0];u.async=1;u.src=l;u.charset='utf-8';d.parentNode.insertBefore(u,d)
})(window, document, 'script', 'https://apps.inindca.com/journey/sdk/js/web/v1/ac.js', 'ac');
ac('init', 'a061a3fe-7a80-4b50-9d3b-df88c0f9efad', { environment: 'dev' });
ac('load', 'autotrackUrlChange');
</script>
Snippet recommendations
If you have this type of website... | Use this snippet... |
Not sure | SPA |
Mix of traditional and SPA pages | SPA |
Traditional pages only | Website |
Customize how the snippet tracks activity (optional)
If needed, you can customize how the snippet tracks activity on your website:
- If you need to refine how Genesys Predictive Engagement tracks activity on your website, see About event tracking with tag managers.
- You can also customize the Genesys Predictive Engagement tracking snippet with functions from the Journey JavaScript SDK. For example:
Deploy the snippet
After you copy the snippet, review the deployment notes. Then follow the instructions to deploy the tracking snippet:
Deployment notes
- Deploy the Genesys Predictive Engagement tracking snippet on the main window of the website you want 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.
Deploy the snippet with a tag manager
To easily deploy the Genesys Predictive Engagement tracking snippet, use your preferred tag manager. For example:
- Deploy the tracking snippet with Google Tag Manager
- Use Adobe Launch with Genesys Predictive Engagement
- Any other tag manager
Deploy the snippet manually
- Admin > Altocloud > Tracking Snippet.
- Next to the type of snippet you need, click Copy snippet.
- Before you paste the snippet on your website, review the deployment notes.
Verify that the snippet works
When the tracking snippet is properly executed and initialized:
- 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 it on your web pages, check the following things:
- Is the snippet on the correct page?
- Is the snippet correctly placed in the header?
- Are all of the parameters specified correctly?
- Are there any typos, missing characters, or extra white space?
- Have any characters been replaced by their printable equivalents?
- Is the domain on the list of allowed domains?
For more suggestions, see Deployment notes.