Track Tawk.to Chat Engagement in Google Analytics through Google Tag Manager

Tawk.to is getting popular very quickly as a free chat web application. Here’s an easy way to add the service to your website through Google Tag Manager and send an event to Google Analytics when a chat starts.

Let’s begin by adding the Tawk.to widget to our site with GTM. Go to Admin and copy your widget code:

widget-code

Now we’ll create a custom HTML tag in GTM and fire it on all pages.

tawkto-main-tag

This will show the Tawk.to chat pop up on every page of the site.

Let’s add the chat interaction tracking in another custom HTML tag:

tawkto-engagement

Here’s the code I’m using:

<script type="text/javascript">
Tawk_API.onChatStarted = function(){
if(Tawk_API.isVisitorEngaged()){
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({'event': 'chat-started'});
}
};
</script>

There’s also Tag Sequencing setting to fire our main Tawk.to tag before this Tawk.to engagement tag.

And the last tag we’ll create is the GA event tag for chat interaction, which will fire on the chat-started event:

chat-started-tag

We can go to Preview mode and test it. When we started a chat, the chat-started event appeared in the events column of the GTM Debug console and our Chat engagement GA tag was fired:

gtm-debug-mode

We also see the event coming in Google Analytics real-time reports:

events-real-time

From here you can use the event to setup a goal in GA, import it into AdWords or add AdWords / Facebook conversion tracking for the chat interaction activity. Hope you’ll find this useful and try it yourself.

5 Google Analytics posts you don’t want to miss in October

Here’s again the last post of the month saved for the top 5 interesting Google Analytics related resources I found on other sites. Here’s the selection for October – you may want to bookmark those as they can be very useful:

How to A/B Test with Google Tag Manager | Measureschool

In this video, Justin shows how to use Google Tag Manager as A/B testing tool and avoid paying for Optimizely or VWO. With this implementation the data will be sent to Google Analytics and you’ll need to calculate the winner additionally.

How to Find and Purge Personally Identifiable Information from Your Google Analytics

This post explains what constitutes as personal identifiable information (PII) and how to avoid passing this information to Google Analytics using different methods.

9 things you need to know about tracking social media with Google Analytics

Learn how social media is automatically tracked by GA, how to correctly track your paid social campaigns, use the social reports available in GA, and more!

How to Use Search Analytics in Google Sheets for Better SEO Insights

This small guide shows how to use the Search Analytics for Sheets add-on to fetch data from Google Search Console (via its API), grouped and filtered to your liking, and create automated monthly backups.

Spotlight on Google Tag Manager: Open and Secure Tag Management

Google introduced new third-party tag templates for GTM and added the recommendation to split the container snippet into two parts: a JS snippet to be placed in the <head> of the pages, and an iframe snippet that should be implemented just after the opening <body> tag.

P.S. Got a Google Analytics question? Send it to me and I’ll try to answer it on the blog.

Measure the Real Conversion Rate with a Calculated Metric

Back in 2006, Avinash Kaushik published this post about measuring the real conversion rate and opportunity pie.

The way a standard conversion rate is calculated in GA (number of conversion completions divided by number of sessions) is actually overestimating the possibilities for improvement.

So now that we have calculated metrics, we can apply some simple math and figure out what your actual conversion rate is.

Please note that Avinash suggests to calculate it by dividing the outcomes and unique visitors:

Conversion Rate = Outcomes / Unique Visitors

As I’m going to apply this calculated conversion rate to the majority of the standard session-based report, I’ll use the non-bounced sessions as divider:

Conversion Rate = Outcomes / (Sessions – Bounces)

So the setup looks like this:

calculated metrics formula

And this is the formula (make sure to replace with your goal):
{{X (Goal 1 Completions)}} / ({{Sessions}} – {{Bounces}})

And here’s the result in a custom report:

custom-report-conversion-rate

What’s your favorite calculated metric?

Limited AdWords data in Google Analytics

For a recent task I needed to pull a combination of AdWords and Google Analytics data:

Dimensions needed: Campaign, Ad Group, Keyword, Device Category, Hour, Custom Dimension 2
Metrics needed: Sessions, Bounce Rate, Clicks, Cost, CPC

Easy, right? First, I tried a simple custom report:

custom-report-setup

But when you run it, there’s no data for the AdWords metrics (clicks, cost, CPC):

custom-report-zeros

Zeros.

So it turned out that when you connect AdWords and GA, you can combine a limited number of dimensions. In our case, it will work if I remove the Hour and Custom dimensions:

custom-report-ok

The AdWords support sent me a copy-paste reply about the AdWords API, although my original question was about GA Reporting API:

adwords-reply

Their Twitter support was more adequate:

twitter1twitter2

So you can combine your AdWords metrics with specific GA dimensions only. The available options are:

Acquisition: medium, source, source/medium, traffic type
Advertising: account, ad content, ad distribution network, ad group, adwords ad group id, adwords campaign id, adwords creative id, adwords criteria id, adwords customer id, destination URL, keyword, keyword match type, query match type, query word count, search query, social annotation type, trueview video ad
Time: date, day index, day of the month, day of week, day of week name, month index, month of the year, month of year, week index, week of the year, week of year, year
Users: device category, mobile (including tablet)

No custom dimensions, hours, behavior, social or ecommerce dimensions.

In addition, there are different options available in the different AdWords reports as well. For example, you can add keywords as secondary dimension to search query in the Search Queries report, but you can’t add search query as a secondary dimension to the Keywords report. The Hour of Day report doesn’t contain any Clicks tab / data. The Sitelinks report is also limited being quite new.

So just something to keep in mind – not all AdWords metrics are available for different combinations in GA reports.

5 Google Analytics posts you don’t want to miss in September

Here’s again the last post of the month saved for the top 5 interesting Google Analytics related resources I found on other sites.

So much good stuff this month! It’s hard to pick up only 5 blogs to share. Here’s the selection for September – you may want to bookmark those as they can be very useful:

Magically track forms using Google Analytics

In this post Benjamin shows how to use Komito Analytics to track form abandonment and interactions fast and easy. It’s JavaScript that you can add in Google Tag Manager and automatically track a number of custom interactions.

Tracking Multiple Categories in Google Analytics for Content Pages

A step-by-step tutorial how to track articles that are associated with multiple tags and categories in Google Analytics. You’ll create a custom dimension for each page category and a custom metric to track how often each category is viewed.

Get the Recipe: Hover Tracking in Google Tag Manager

Google Tag Manager doesn’t automatically listen for hover events and the awesome guys at LunaMetrics provided a recipe that you can download and import into your GTM container. Follow the extra instructions and start tracking hover events!

10 JavaScript Concepts For Web Analytics Implementation

This blog from Simo follows a conference talk he gave at MeasureCamp IX, London earlier this month. I agree that understanding the JavaScript basics are extremely important in web analytics implementation. Go through the 10 JS concepts presented and if you’re still feeling lost, go ot Codecademy, get a book about JS and practice!

Google updates – there were so many amazing announcements from the GA team: you can move GA properties (extremely useful for agencies that have all their customers GA sites under one account), work with the improved unique events metric and sign up for the free Google Optimize!

P.S. Got a Google Analytics question? Send it to me and I’ll try to answer it on the blog.