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

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 are the five for May – you may want to bookmark those as they can be very useful:

Ad Block Tracking With Google Analytics: Code, Metrics, Reports

Here Avinash explains what’s an ad block and offers a tracking code change through Google Tag Manager or directly together with setting the custom dimensions and segments in Google Analytics. The last part shows 5 reports and KPIs that deliver critical insights from ad blocking behavior. If you’re concerned about your customers using ad blockers, this is the way to understand its impact.

Seer’S Google Analytics heatmap to find your website’s peak times [Download]

Inspired by the heatmap feature in the redesigned GA Mobile App, the Analytics Team at Seer built a Google sheet that you can save in your account which allows you to heatmap certain metrics to identify growing or hot trends over time. It’s really cool, so check it out with your data!

#GTMTips: Using document.write Safely In GTM Tags

Simo’s blog is again featured 2 times this month. This first one is a guest post by Dan Wilkerson from LunaMetrics about the document.write() method used in the Google Tag Manager Custom HTML tags. It explains the problems with having document.write in your 3rd party marketing tags and the proper way to run them in GTM.

Simple Tracker Duplication For Universal Analytics

If you need to easily implement a roll-up GA property with exact hit duplication, this plugin that Simo developed can help. The implementation is straightforward and is recommended to use it with on-page Universal Analytics tracking, not with Google Tag Manager.

Announcing Data Studio: our free, new, Data Visualization Product

Google announced a free version of Data Studio for individuals and smaller teams and you can access it at http://google.com/analytics/data-studio There are a couple of videos about it in the GA Youtube channel and it looks great! You can connect all your marketing data (GA, AdWords, Google Sheets, BigQuery and soon SQL databases to access first party data) and turn that data into beautiful, informative reports that are easy to understand, share (like Google Docs), and fully customizable.

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

New in Google Analytics: User Explorer report

GA announced a cool new report called User Explorer in the beginning of May that went a bit unnoticed. I was pleased to see it in my accounts in the Audience section (it should be available from March 9, 2016 forward):


The User Explorer report lets you see individual users associated with Client ID or User ID. While GA shows only aggregate data, this feature was a big selling point for tools like KissMetrics. Understanding individual behavior is important when you want to personalize the user experience or find issues to improve.

If you haven’t implemented the User ID feature, by default GA will show Client IDs:

Client IDs:


User IDs in the User ID enabled view:


The metrics available are sessions, average session duration, bounce rate, revenue, transactions and goal conversion rate. Unfortunately there’s no filter field to easily get users with revenue > $100 or by another metric / dimension. You should use segments for this.

When you click an ID, you’ll get a snapshot of the user: the acquisition date, channel and device category for the user, as well as an activity log that list all actions by the user during each session.


Here you can filter by any combination of pageviews, goals, ecommerce and events using the Filter by menu:


You can also expand and collapse sessions, and expand individual actions for more details.

Now let’s create a segment. It can be only user-based and we can apply only one segment at a time. I’ll select a combination of specific event and the ecommerce hit and click the Create Segment button:


If we go back to the User Explorer report and apply our new segment, we’ll see all users that match the conditions (just 2 in my case):


From there you can easily export the list of IDs matching your segment.

How to use the User Explorer report:

  • Respond to specific behavior within a segment – if other reports show valuable behavior by a particular segment, you can examine specific users within that segment to get a more detailed understanding of what’s going on.
  • Upsell – understand how your high-value customers purchase so you can lead the next tier of customers along that same path. Export the IDs of middle-value customers to personalize their site experience to more closely match the experience of your high-value customers, or build an audience and serve it ads for the more expensive products.
  • Remarketing – you can create segments based on the relevant behavior you identify in the User Explorer report (like abandoned shopping carts), and then use those segments as the basis for new remarketing audiences showing exactly the same products or suggested upsells.
  • Personalize customer service – it will be extremely valuable for your customer service representatives to check the User Explorer report for a detailed history of each user and understand the context.
  • Identify personas – you have personas as part of your marketing, right? Investigate the behavior of different segments so that those personas are based on how users engage with your site.

The new User Explorer report is great and I can’t wait to use it. If you have a lot of traffic and try to apply a segment though, you’ll hit the sampling issue and without these options available in the reporting API you need to make your date range shorter, export multiple reports and combine them to get the full list of IDs.

Have you tried the User Explorer report yourself? What do you like about it? Any problems?

5 Google Analytics posts you don’t want to miss in April (+ 3 extra)

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 are the five (and 3 extra) for April – you may want to bookmark those as they can be very useful:

How to Use GTM Download Redirects to track Links, Downloads and Email Clicks | Measureschool

In this video (9:27 min) Julian shows how to track email links, downloads and other outbound resources sent in an email more precisely with a combination of redirects in Google Tag Manager and Google Analytics. It’s pretty cool!

Tracking Funnels With Google Analytics Enhanced Ecommerce Tracking | Measureschool

In this video (17:04 min) Julian shows how to build you own customized funnel using Enhanced Ecommerce tracking in Google Analytics and Google Tag Manager, even if you don’t have an Ecommerce website. This will help you get super actionable insights and segments to help you in your marketing.

Panic Time or False Alarm? A Beginner’s Guide to Traffic Drop Analysis

This step-by-step guide from Distilled will help you understand your client’s traffic drop – is it a real problem, seasonality or broken tracking issue? This post will walk you through the process of confirming what actually happened and understanding why it happened in the first place.

Why Am I Seeing 307 Redirects on My Google Analytics Collect Hits?

Maybe you noticed the duplicated or redirected Google Analytics hits in the network tab of browser’s developer tools. GA didn’t really announced their migration to HTTPS and this post by Analytics Pros was quick to explain the reason. HTTP requests with a status code 307 are not sent to GA and only serve as redirects, so your hits are not double counted.

Google Analytics – Querystring parameter INCLUSION is the new black

As sites grow in scale and complexity, more query string parameters are showing up in page paths that may pollute your data and artificially inflate cardinality in pages reports. This blog explains how to use a series of filters to include only the useful query string parameters we want – all others are excluded.

#GTMTips: The Timer Trigger

Here Simo shows how to create your own timer in GTM which fires after a certain amount of time has passed on the web page. This is especially useful if you want to start a timer based on a user interaction such as a click, but this option is not available in the current GTM version.

Buy-To-Cart Rates by Digging Deep in GA Enhanced Ecommerce

This LunaMetrics post shows how to answer questions like what’s the likelihood that a user put something in their cart and then purchased at some point later, which goes beyond the standard Enhanced Ecommerce reports in GA. You can do this both with the free version and GA 360 and discover metrics like buy-to-cart rate within N days and average purchase lag.

More Accurate Conversion Data with Sequence Segments

Another LunaMetrics post this month showing how to use sequence segments to answer questions like: Is that new page of content driving more lead forms? Is this month’s home page banner driving more free trial sign-ups? You specify conditions for each step, and each step must occur in order.

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

Pass dynamic data to Google Sheets using Google Tag Manager

Let’s say you want to use Google Sheets as a simple database to store your incoming inquiries with all details people fill in the form submission. You can’t use Google Analytics for it as it doesn’t allow personal identifiable information like email address to be stored. That’s why we’ll pass the data through Google App scripts to a Google Sheet, for free.

You can do the same with Zapier, where the coding part is hidden behind their beautiful interface, but their free version supports up to 100 tasks / month.

Let’s start by creating a simple sheet – my contact form has several fields I want to capture, like name, email, and subject. And in addition I’ll record a timestamp in GMT. So I’ll have these 4 as column titles:

table columns

Now we need the app script to do the magic. We go to Tools – Script Editor… and a new tab will open to write your script. We’ll remove the placeholder with the code below, courtesy of Martin Hawskey. It’s slightly updated, as his original version wasn’t working for me.

// Usage
// 1. Enter sheet name where data is to be written below
// 1. Enter sheet name and key where data is to be written below
var SHEET_NAME = "Sheet1";
var SHEET_KEY = "insert-sheet-ID-here";

// 2. Run > setup
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)
// 4. Copy the 'Current web app URL' and post this in your form/script action
// 5. Insert column names on your destination sheet matching the parameter names of the data you are passing in (exactly matching case)

var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service

// If you don't want to expose either GET or POST methods you can comment out the appropriate function
function doGet(e){
return handleResponse(e);

function doPost(e){
return handleResponse(e);

function handleResponse(e) {
var lock = LockService.getPublicLock();
lock.waitLock(30000); // wait 30 seconds before conceding defeat.

try {
// next set where we write the data - you could write to multiple/alternate destinations
var doc = SpreadsheetApp.openById(SHEET_KEY);
var sheet = doc.getSheetByName(SHEET_NAME);

// we'll assume header is in row 1 but you can override with header_row in GET/POST data
var headRow = e.parameter.header_row || 1;
var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues()[0];
var nextRow = sheet.getLastRow()+1; // get next row
var row = [];
// loop through the header columns
for (i in headers){
if (headers[i] == "Timestamp"){ // special case if you include a 'Timestamp' column
row.push(new Date());
} else { // else use header name to get data
// more efficient to set values as [][] array than individually
sheet.getRange(nextRow, 1, 1, row.length).setValues([row]);
// return json success results
return ContentService
.createTextOutput(JSON.stringify({"result":"success", "row": nextRow}))
} catch(e){
// if error return this
return ContentService
.createTextOutput(JSON.stringify({"result":"error", "error": e}))
} finally { //release lock

We need to specify our Sheet so we copy the part between /d/ and /edit and paste it in the insert-sheet-ID-here quotes on line 5.


We can name our project however we like and save our script. As a next step, we select Publish – Deploy as web app, change the Who has access to the app setting to Anyone, even anonymous, and hit Deploy button.


The first time it will ask for authorization, click Continue and Allow and you’ll be presented with the web app URL:

Copy it as we’ll need it to complete our setup.

Now, let’s create the variables in GTM that will pass the data we want. In my case I have 3 text fields and I’ll use their class names coming from Contact Form 7 WordPress plugin.

This is what my button looks like:

<input class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" name="your-name" size="40" type="text" value="" />

Name custom JS variable:

function() {
var inputField = document.getElementsByClassName("wpcf7-form-control wpcf7-text wpcf7-validates-as-required")[0];
return inputField.value || "";

Email custom JS variable:

function() {
var inputField = document.getElementsByClassName("wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email")[0];
return inputField.value || "";

Subject custom JS variable:

function() {
var inputField = document.getElementsByClassName("wpcf7-form-control wpcf7-text")[0];
return inputField.value || "";

You can quickly test them in the Console of Chrome Developer tools: custom-JS-variables-test

Timestamp custom JS variable:

var today = new Date();
var str = today.toUTCString();
return str;

Now we have all our variables and we’ll contruct our GET call:

https://script.google.com/macros/s/<replace with your web app URL>/exec?Name={{Name}}&Email={{Email}}&Subject={{Subject}}&Date={{Timestamp}}

Be careful to use exactly the same words as it’s case sensitive.

You can test how this works if you open the link in a new tab – you should get a success result {“result”:”success”,”row”:2} and if you check your sheet, it’s automatically populated:

Google-Sheet-populatedWe can remove the dummy data later.

Now let’s create the tag that will fire this in GTM, I’ll use a Custom Image tag. Give it a name, paste your string in the Image URL field and select your trigger (the form submission in my case):

Create the tag, enter Preview and Debug mode and let’s see what happens. Go to your form, make a submission and we’ll see our tag being fired:


Also, when we check our sheet, it’s already there: Google-Sheets-final

Like magic! 🙂

5 Google Analytics posts you don’t want to miss in March (+ 3 extra)

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 are the five (and 3 extra) for March – you may want to bookmark those as they can be very useful:

Google Analytics and Google Tag Manager Debugging Tools

LunaMetrics shares a variety of built-in tools and Google Chrome Extensions. These tools enhance visibility into the mechanics of the inner workings of GA/GTM and help with the configuring and debugging as well as previewing. The list includes: the JavaScript Console, Google Tag Manager Preview Mode, Google Analytics Debugger, Google Tag Assistant, Injector, Tag Manager Injector, Code Editor for GTM, EditThisCookie.

Track Content Engagement Via GTM (Part 1 and Part 2)

In this two-part series Simo shows how to track how much time users are actually spending engaged with your content. Interaction is counted as clicks, mouse movements, keyboard presses, and scrolls. And it’s important to check both articles as in the first he uses User Timings and in the second they’re replaced with a Custom Metric.

Introducing the Google Analytics 360 Suite

Google Analytics announced the introduction of the Google Analytics 360 Suite – a new collection of products targeting enterprises. It includes Google Audience Center 360 (beta), Google Optimize 360 (beta), Google Data Studio 360 (beta), Google Tag Manager 360, Google Analytics 360 (GA Premium), and Google Attribution 360 (Adometry). Although not all products are launched yet, they promise to solve the issues to see the complete customer journey, get useful insights, enable better sharing within the organization and deliver engaging experiences.

Getting Started with Google Optimize 360

This is an overview of the new Google Optimize 360 that’s still in beta and only selected companies have access to the product. It allows for integration with Google Analytics for both targeting and analysis. You can very quickly create audiences from GA that provide personalization and targeting that would require complex integrations in other tools. It looks great, and I’m waiting to hear the price!

Instantiating & Using The Google Tag Manager dataLayer – Data Layer Best Practices Pt 1 (Part 2, Part 3, Part4)

Here’s a 4-part series of posts from LunaMetrics showing the technical best practices designed to help you successfully interoperate with the Google Tag Manager Data Layer. You’ll learn the proper way to instantiate and work with the dataLayer, pushing to the dataLayer from within Custom HTML Tags, when and how to reference the dataLayer within Custom JavaScript Variables, and how to reset or purge values in the Data Layer properly.

Mapping User Constituencies to Google Analytics Segments

This is a practical example of creating segments that map to a user constituency.

Find Related Products Purchased Together in Google Analytics

If you use Enhanced Ecommerce, don’t miss to enable this feature.

Pull More than 10k rows Unsampled using Google Analytics Sheets Add-on

I found this older post just now, but it’s great when you need to export thousands of rows in a report.

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