Home > FAQ Google Analytics

Categories: | | | |


(Last Updated On: July 30, 2021)

About This Article

This article clarifies commonly asked questions about Google Analytics.

My SnapEngage events are not being tracked in Google Analytics

Check your website to see if the Google Analytics events and SnapEngage code have been added correctly. Be sure that the Google Analytics Global Tracking Code is added directly below the SnapEngage code.

Are you using the same version of Google Analytics across both the Global Site Tracking Code and the events you are tracking?

Has it been copied correctly?

If so, the code may have been added twice; once in Google Tag Manager and once on the site itself. Remove one instance.

The Google Analytics Tracking code, and the SnapEngage code containing the Google Analytics events, should both be installed within the same Custom HTML snippet in Google Tag Manager.

If you are only tracking Proactive engagement, be sure to start a Proactive Chat, for example.

 

If you are not sure what each event tracks, you can check this to understand more:

https://developer.snapengage.com/#javascript-events

Where will you see those events?

In your Google Analytics account under  Behaviour > Events > Overview.

Click here to see a clear screenshot

 

So you only want to track Proactive Chat Engagement?

You can find the code for this here. What you do with this snippet is to track the StartChat event only in case the chat was a proactive one:
ga.js (legacy analytics)

var seAgent; SnapEngage.setCallback('OpenProactive', function(agent, msg) { seAgent = agent; _ gaq.push(['_trackEvent', 'SnapEngage', 'proactivePrompt', agent]); }); SnapEngage.setCallback('StartChat', function(email, msg, type) { if (type == 'proactive') { _gaq.push(['_trackEvent', 'SnapEngage', 'proactiveEngaged', seAgent]); } });

analytics.js

var seAgent; SnapEngage.setCallback('OpenProactive', function(agent, msg) { seAgent = agent; ga('send','event','SnapEngage', 'proactivePrompt', agent); }); SnapEngage.setCallback('StartChat', function(email, msg, type) { if (type == 'proactive') { ga('send','event','SnapEngage', 'proactiveEngaged', seAgent); } });

gtag.js

var seAgent; SnapEngage.setCallback('OpenProactive', function(agent, msg) { seAgent = agent; gtag('event', 'proactivePrompt', { 'event_category' : 'SnapEngage', 'event_label' : agent }); });
SnapEngage.setCallback('StartChat', function(email, msg, type) { if (type == 'proactive') { gtag('event', 'proactiveEngaged', { 'event_category' :'SnapEngage', 'event_label' : seAgent }); } });

Since you will be tracking all proactive chat invites with OpenProactive and with StartChat the responded proactive chats, you divide the latter with the first and you get the percentage of how many proactive invites have been answered by visitors.

Using the labels of the above screenshot:

Proactive Chat Engagement = ProactiveEngaged / proactivePrompt

And can I actually measure how successful a specific Proactive Chat message is?

Yes you can! You can calculate the “Proactive Engagement Rate” for each Proactive Chat message you have set up. You can read more about this here and find a sample code for the newest version of the analytics code below.

gtag.js

var seAgent; var proactivePrompt = ''; SnapEngage.setCallback('OpenProactive', function(agent, msg) { seAgent = agent; proactivePrompt = msg; gtag('event', 'proactivePrompt', { 'event_category' : 'SnapEngage', 'event_label' : msg }); });
SnapEngage.setCallback('StartChat', function(email, msg, type) { if (type == 'proactive') { gtag('event', 'proactiveEngaged', { 'event_category' :'SnapEngage', 'event_label' : proactivePrompt }); } });

When you use this proactive engagement tracking, can you still use a separate StartChat tracking snippet to track all chats? Manual included.

Of course, you can! Sky’s the limit.

Want to track Proactive Chat Engagement AND manual chats?

Here are some more examples for you.
ga.js (legacy analytics)

SnapEngage.setCallback('StartChat', function(email, msg, proactive) { _gaq.push(['_trackEvent', 'SnapEngage', 'proactiveEngaged', seAgent]); }); { else if (type == 'manual') { _gaq.push(['_trackEvent', 'SnapEngage', 'manual', seAgent]); }); } });

analytics.js

var seAgent; SnapEngage.setCallback('StartChat', function(email, msg, proactive) { ga('send', 'event', 'SnapEngage', 'proactiveEngaged', seAgent); }); { else if (type == 'manual') { ga('send','event','Snapengage','manual', seAgent); }); } });

gtag.js

var seAgent; SnapEngage.setCallback('StartChat', function(email, msg, type) { if (type == 'proactive') { gtag('event', 'proactiveEngaged', { 'event_category': 'SnapEngage', 'event_label': seAgent }); } else if (type == 'manual') { gtag('event', 'manual', { 'event_category': 'Snapengage', 'event_label': seAgent }); } });

Can I pass JavaScript variables as Label values?

Yes, absolutely! For example, if you define a variable called accountNumber, like so:

 

<!– begin global variables for SnapEngage –>
<script type=”text/javascript”>
var accountNumber = 123456;
</script>
<!– end global variables for SnapEngage –>

Please note, this needs to be added prior to the SnapEngage code being initiated. You can read more here.

Next, in the event, you would need to replace the Label value with the variable name, like this example below:

SnapEngage.setCallback('StartChat', function(agent, msg, type) { seAgent = agent; gtag('event', 'Chat', { 'event_category' : SnapEngage, 'event_label' : accountNumber }); });

This will display the value 123456 as the Label value in Google Analytics.

Did you find this article helpful?

Not HelpfulNeeds WorkSo-soHelpfulVery Helpful (No Ratings Yet)
Loading ... Loading ...

Published October 23, 2019