Difference between revisions of "ATC/Current/AdminGuide/Tracking snippet"

From Genesys Documentation
Jump to: navigation, search
(Published)
(Published)
Line 10: Line 10:
 
** '''Journey '''>''' Settings''' > '''Edit''', or '''View''' permissions
 
** '''Journey '''>''' Settings''' > '''Edit''', or '''View''' permissions
 
|Section={{Section
 
|Section={{Section
|sectionHeading=About the tracking snippet
+
|sectionHeading=Before you begin
 
|Type=Structured
 
|Type=Structured
|anchor=AboutSnippet
 
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=To enable tracking on your website, you must deploy the {{MINTYDOCSPRODUCT}} tracking snippet. The following code is the {{MINTYDOCSPRODUCT}} tracking snippet that enables you to track visitor activity on your webpages.
+
|structuredtext=Before you deploy the {{MINTYDOCSPRODUCT}} tracking snippet be sure you understand:
 +
* How to deploy the tracking snippet to be compliant with {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=GDPR}}<br />
 +
|fullwidth=No
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Ad blockers
 +
|Type=Structured
 +
|anchor=AdBlockers
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext=9/17: David Trihy to create a research spike on ad blockers in general for next sprint (38)When this is ironed out, add this text to the Before you begin section as Step 2:
 +
 
 +
 
 +
The effects of [#AdBlockers ad blockers]
 +
on Altocloud.
 +
 
 +
Ad blockers are plug-ins or browser extensions that prevent tracking software, such as trackers used for advertising purposes, from running on a website. Because {{MINTYDOCSPRODUCT}} is a type of tracking software, some ad blockers detect and block it.{{NoteFormat|Do not use uBlock on any webpages that you want to track with Altocloud.
 +
 
 +
This is not accurate. We can't control when our customers' customers install uBlock. What we really need to say is that our customers need to prompt their customers to disable any ad blockers in order to experience the best user experience on their site.
 +
 
 +
}}
 +
===How uBlock affects {{MINTYDOCSPRODUCT}}<br />===
 +
uBlock adversely affects {{MINTYDOCSPRODUCT}} in the following ways
 +
* If you use Google Tag Manager, uBlock prevents you from loading the tracking snippet and Journey JavaScript SDK.
 +
* If you use a different JavaScript management approach, the tracking snippet and Journey JavaScript load on your webpages. However, Altocloud will be unable to send beacons or register cookies, effectively preventing it from working as expected.
 +
|fullwidth=No
 +
|Status=Yes
 +
}}{{Section
 +
|sectionHeading=Deploy the tracking snippet
 +
|Type=Structured
 +
|anchor=Deploy
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext=To deploy the tracking snippet:
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#GetSnippet|display text=Get the snippet.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#WhereToDeploy|display text=Identify where to deploy the snippet.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#TagManagers|display text=Use a tag manager.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#Customize|display text=Customize the snippet.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#VerifySnippet|display text=Verify that the snippet works.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#TroubleshootSnippet|display text=Troubleshoot the snippet.}}
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#ErrorSnippet|display text=Review error messages.}}
 +
|fullwidth=No
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Get the snippet
 +
|Type=Structured
 +
|anchor=GetSnippet
 +
|alignment=Horizontal
 +
|image=ScriptTags.png
 +
|gif=No
 +
|structuredtext=# Click '''Admin'''.
 +
# Under '''Altocloud''', click '''Tracking Snippet'''. <br />
 +
# {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#SelectSnippet|display text=Select the type of snippet you need.}}
 +
# Copy the code.
 +
 
 +
{{NoteFormat|
 +
*Since you are logged in to PureCloud, the {{MINTYDOCSPRODUCT}} tracking snippet already contains your organization ID and your Genesys region.
 +
# When you copy the Altocloud tracking snippet into your {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#TagManagers|display text=tag manager}}, remove both script tags.
 +
* If you copy and paste the tracking snippet into an email or other editing program, that program may insert or replace characters in the tracking snippet. If you need to copy and paste the tracking snippet, use a text editor to ensure a clean copy and paste.}}
 +
|fullwidth=No
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Types of tracking snippets
 +
|Type=Structured
 +
|anchor=SelectSnippet
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext=Select the appropriate {{MINTYDOCSPRODUCT}} tracking snippet for your environment.
 +
===Basic snippet===
 +
The basic 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 basic snippet calls <tt>{{Link-SomewhereInThisVersion|manual=SDK|topic=Pageview|display text=ac('pageview')}}</tt> each time the a new page is loaded by the web browser.
  
 
<source lang="javascript">
 
<source lang="javascript">
Line 22: Line 90:
 
   (a[o].q=a[o].q||[]).push(arguments)},a[o].l=1*new Date();u=t.createElement(c),
 
   (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)
 
   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');
+
   })(window, document, 'script', 'https://example.com, 'ac');
 
   ac('init', 'a061a3fe-7a80-4b50-9d3b-df88c0f9efad', { region: 'use1' });
 
   ac('init', 'a061a3fe-7a80-4b50-9d3b-df88c0f9efad', { region: 'use1' });
 
   ac('pageview');
 
   ac('pageview');
Line 28: Line 96:
 
</source>
 
</source>
  
For more information about how the tracking snippet and the Journey JavaScript SDK work, see {{Link-SomewhereInThisVersion|manual=SDK|topic=About_the_tracking_snippet|display text=About the tracking snippet.}}
+
 
 +
===Advanced snippet===
 +
The advanced snippet provides tracking support to Single Page Applications (SPAs). SPAs load dynamic content on demand without requiring a hard reload of the HTML page. Additionally, this functionality can track {{GlossaryTooltip|term=relative links}}, which the traditional snippet does not. The SPA snippet works on any framework that you use with your SPA, including Angular, React, Vue.js, and so on.
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Copy the snippet
+
|sectionHeading=Where to deploy the snippet
 
|Type=Structured
 
|Type=Structured
|anchor=DeploySnippetAdminUI
+
|anchor=WhereToDeploy
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=# Click '''Admin'''.
+
|structuredtext={{NoteFormat|Do not deploy any {{MINTYDOCSPRODUCT}} tracking snippet on any page that collects payment information.|3}}
# Under '''Altocloud''', click '''Tracking Snippet'''. <br />
+
* Deploy the {{MINTYDOCSPRODUCT}} tracking snippet on the main page of the website you want to track.  
# Copy the code. {{MINTYDOCSPRODUCT}} automatically populates your organization ID and region.
+
* Paste the {{MINTYDOCSPRODUCT}} tracking snippet in the element of the website template page before the closing tag.
# Paste the {{MINTYDOCSPRODUCT}} tracking snippet in the <tt></tt> element of the website template page before the <tt></tt> closing <tt></tt> tag.
+
* Do not deploy the tracking snippet in an iframe.
{{NoteFormat|
 
* Since you are logged in to the Admin UI, the  {{MINTYDOCSPRODUCT}} tracking snippet already contains your organization ID and your Genesys region.
 
* If you are concerned about using {{MINTYDOCSPRODUCT}} in a GDPR-compliant manner, see {{#mintydocs_link:manual=AdminGuide|topic=GDPR|link text=GDPR}}.<br />
 
* The last argument in the {{MINTYDOCSPRODUCT}} tracking snippet is  <tt>'ac'</tt>. If your webpage or any third-party JavaScript uses this variable name globally, pass a custom value.<br />
 
* When you call <tt>`ac`</tt>, the commands after it, such as <tt>init</tt>, <tt>pageview</tt>, and so on, are queued. When the website template file is completely downloaded, the queued commands are executed.|1}}
 
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Deploy the snippet with a tag management system
+
|sectionHeading=Tag managers
 
|FAQHeading=Why doesn't my tag management system properly deploy the tracking snippet?
 
|FAQHeading=Why doesn't my tag management system properly deploy the tracking snippet?
 
|Type=Structured
 
|Type=Structured
|anchor=DeploySnippetTagMgmt
+
|anchor=TagManagers
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext=To easily deploy the {{MINTYDOCSPRODUCT}} tracking snippet, use a tag management system such as:
 +
* {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#GoogleTagMgr|display text=Google Tag Manager}}
 +
* Adobe Launch
 +
* Tealium
 +
|fullwidth=No
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Google Tag Manager
 +
|Type=Structured
 +
|anchor=GoogleTagMgr
 +
|alignment=Vertical
 +
|gif=No
 +
|structuredtext=Google Tag Manager provides numerous predefined triggers and tags to refine the {{MINTYDOCSPRODUCT}} tracking snippet. For example:
 +
* Click element
 +
* Click class
 +
* Click ID
 +
* Click Target
 +
* Click URL
 +
* Click TextErrors
 +
* Error Message
 +
* Error URL
 +
* Error LineForms
 +
* Form Classes
 +
* Form Element
 +
* Form ID
 +
* Form Target
 +
* Form Text
 +
* Form URLScroll
 +
* Scroll Depth Threshold
 +
* Scroll Depth Units
 +
* Scroll Direction
 +
For complete information on the custom tags that are available with Google Tag Manager, see [https://support.google.com/tagmanager/answer/6107167?hl=en&reftopic=3002579&authuser=0  Custom tags].
 +
|fullwidth=No
 +
|Status=No
 +
}}{{Section
 +
|sectionHeading=Customize the snippet
 +
|Type=Structured
 +
|anchor=Customize
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=To easily deploy the {{MINTYDOCSPRODUCT}} tracking snippet, use a tag management system such as Google Tag Manager, Tealium, Adobe Dynamic Tag Manager, and any others that provide the option to add custom JavaScript code.<p class="mw_paragraph">{{NoteFormat|Do not deploy the {{MINTYDOCSPRODUCT}} tracking snippet on any page that collects payment information.|3}}
+
|structuredtext=* If you need to refine how {{MINTYDOCSPRODUCT}} tracks activity on your website, use the predefined custom tags that your {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet|display text=tag manager}} provides. For example:
<h3>Notes for using a tag manager</h3><ul><li>Execute the tracking snippet on the main window of the website you want to track. </li><li>Do not execute the tracking snippet in an iframe.</li><li>When properly executed and initialized, the pinging should be frequent (once every 4-5 seconds), and it should return status code 200.</li><li>When you copy the tracking snippet into your tag manager, omit both <tt><script></tt> and <tt></script></tt> tags.</li></ul>
+
** {{Link-SomewhereInThisVersion|manual=AdminGuide|topic=Tracking_snippet#GoogleTagMgr|display text=Examples from Google Tag Manager}}
 +
* If your tag manager's predefined tags do not provide the level of customization you need, customize the {{MINTYDOCSPRODUCT}} tracking snippet with functions from the {{Link-SomewhereInThisVersion|manual=SDK}}. For example:
 +
** {{Link-SomewhereInThisVersion|manual=SDK|display text=Use the Journey JavaScript SDK to track page view events and to configure how Altocloud updates cookies. }}
 +
** {{Link-SomewhereInThisVersion|manual=SDK|topic=Configure_advanced_tracking|display text=Configure advanced tracking to enable tracking across multiple domains.}}
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Enhance your tracking
+
|sectionHeading=Verify that the snippet works
 
|Type=Structured
 
|Type=Structured
 +
|anchor=VerifySnippet
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
|structuredtext=There are several ways to enhance how you track visitor activity:
+
|structuredtext=When the tracking snippet is properly executed and initialized:
* {{Link-SomewhereInThisProduct|version=Current|manual=AdminGuide|topic=Smart_tags|display text=Use smart tags to track activity such as form-level events. }}
+
* You should receive a ping every 4-5 seconds.
* {{Link-SomewhereInThisVersion|manual=SDK|display text=Use the Journey JavaScript SDK to track page view events and to configure how Altocloud updates cookies. }}
+
* The ping should return status code 200.
* {{Link-SomewhereInThisVersion|manual=SDK|topic=Configure_advanced_tracking|display text=Configure advanced tracking to enable tracking across multiple domains.}}
 
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
|sectionHeading=Troubleshooting
+
|sectionHeading=Troubleshoot the snippet
 
|FAQHeading=How can I troubleshoot the tracking snippet??
 
|FAQHeading=How can I troubleshoot the tracking snippet??
 
|Type=Structured
 
|Type=Structured
 +
|anchor=TroubleshootSnippet
 
|alignment=Vertical
 
|alignment=Vertical
 
|gif=No
 
|gif=No
 
|structuredtext=If the tracking snippet does not work properly when you load it on your web pages, check the following things:<br />* Is the snippet on the correct page?<br />* Is the snippet correctly placed in the header?<br />* Are all of the parameters specified correctly?<br />* Are there any typos, missing characters, or extra white space?
 
|structuredtext=If the tracking snippet does not work properly when you load it on your web pages, check the following things:<br />* Is the snippet on the correct page?<br />* Is the snippet correctly placed in the header?<br />* Are all of the parameters specified correctly?<br />* Are there any typos, missing characters, or extra white space?
 
 
{{NoteFormat|If you copy and paste the tracking snippet into an email or other editing program, that program may insert or replace characters in the tracking snippet. If you need to copy and paste the tracking snippet, use a text editor to ensure a clean copy and paste.}}
 
 
|fullwidth=No
 
|fullwidth=No
 
|Status=No
 
|Status=No
Line 85: Line 191:
 
|sectionHeading=Error reference
 
|sectionHeading=Error reference
 
|Type=Unstructured
 
|Type=Unstructured
 +
|anchor=ErrorSnippet
 
|freetext={{{!}} class="wikitable" style="height: 266px;" width="865" data-mce-style="height: 266px;"
 
|freetext={{{!}} class="wikitable" style="height: 266px;" width="865" data-mce-style="height: 266px;"
 
{{!}}-
 
{{!}}-

Revision as of 14:11, September 23, 2019

Deploy the Genesys Predictive Engagement tracking snippet to enable visitor tracking on your website.

Prerequisites

Before you begin

Before you deploy the Genesys Predictive Engagement tracking snippet be sure you understand:

Ad blockers

9/17: David Trihy to create a research spike on ad blockers in general for next sprint (38)When this is ironed out, add this text to the Before you begin section as Step 2:


The effects of [#AdBlockers ad blockers]

on Altocloud.
Ad blockers are plug-ins or browser extensions that prevent tracking software, such as trackers used for advertising purposes, from running on a website. Because Genesys Predictive Engagement is a type of tracking software, some ad blockers detect and block it.
Important
Do not use uBlock on any webpages that you want to track with Altocloud.

This is not accurate. We can't control when our customers' customers install uBlock. What we really need to say is that our customers need to prompt their customers to disable any ad blockers in order to experience the best user experience on their site.

How uBlock affects Genesys Predictive Engagement

uBlock adversely affects Genesys Predictive Engagement in the following ways

  • If you use Google Tag Manager, uBlock prevents you from loading the tracking snippet and Journey JavaScript SDK.
  • If you use a different JavaScript management approach, the tracking snippet and Journey JavaScript load on your webpages. However, Altocloud will be unable to send beacons or register cookies, effectively preventing it from working as expected.

Deploy the tracking snippet

Get the snippet

  1. Click Admin.
  2. Under Altocloud, click Tracking Snippet.
  3. Select the type of snippet you need.
  4. Copy the code.
Important
  • Since you are logged in to PureCloud, the Genesys Predictive Engagement tracking snippet already contains your organization ID and your Genesys region.
  1. When you copy the Altocloud tracking snippet into your tag manager, remove both script tags.
  • If you copy and paste the tracking snippet into an email or other editing program, that program may insert or replace characters in the tracking snippet. If you need to copy and paste the tracking snippet, use a text editor to ensure a clean copy and paste.

Types of tracking snippets

Select the appropriate Genesys Predictive Engagement tracking snippet for your environment.

Basic snippet

The basic 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 basic 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>


Advanced snippet

The advanced snippet provides tracking support to Single Page Applications (SPAs). SPAs load dynamic content on demand without requiring a hard reload of the HTML page. Additionally, this functionality can trackNo results, which the traditional snippet does not. The SPA snippet works on any framework that you use with your SPA, including Angular, React, Vue.js, and so on.

Where to deploy the snippet

Warning
Do not deploy any Genesys Predictive Engagement tracking snippet on any page that collects payment information.
  • Deploy the Genesys Predictive Engagement tracking snippet on the main page of the website you want to track.
  • Paste the Genesys Predictive Engagement tracking snippet in the element of the website template page before the closing tag.
  • Do not deploy the tracking snippet in an iframe.

Tag managers

To easily deploy the Genesys Predictive Engagement tracking snippet, use a tag management system such as:

Google Tag Manager

Google Tag Manager provides numerous predefined triggers and tags to refine the Genesys Predictive Engagement tracking snippet. For example:

  • Click element
  • Click class
  • Click ID
  • Click Target
  • Click URL
  • Click TextErrors
  • Error Message
  • Error URL
  • Error LineForms
  • Form Classes
  • Form Element
  • Form ID
  • Form Target
  • Form Text
  • Form URLScroll
  • Scroll Depth Threshold
  • Scroll Depth Units
  • Scroll Direction

For complete information on the custom tags that are available with Google Tag Manager, see Custom tags.

Customize the snippet

Verify that the snippet works

When the tracking snippet is properly executed and initialized:

  • You should receive a ping every 4-5 seconds.
  • The ping should return status code 200.

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?

Error reference

Comments or questions about this documentation? Contact us for support!