Tracking AMP: Consolidating Visitors in Google Analytics Tracking AMP: Consolidating Visitors in Google Analytics

Tracking AMP: Consolidating Visitors in Google Analytics

by , Consultant Digital Analytics
on 20 April 2018

0
0

In offering “lightning fast” loading times, AMP have become unavoidable for engaging mobile users. A problem on the analytics side: by default, Google Analytics (GA) is unable to reconstruct a visit that passes through an AMP and continues on to your classic site.

Problem

To collect the AMP traffic in GA, Google offers documentation for a relatively simple implementation.

And it’s also possible to integrate an AMP-specific Google Tag Manager (GTM) container with a standard Google Analytics tag – no free form scripts.

The documentation recommends using another GA property to collect traffic data on these AMP. That’s the recommended manner because the environment is different from the classic site so it should be analyzed differently. And that’s true! Besides, the documentation suggests analyzing AMP like sources of traffic in the classic site’s property.

What bothers me is that I will have on one hand data concerning my AMP pages – sources, pages seen, and possibly events – but not the path through the site or the associated conversions. And on the other hand, I will have data concerning my classic site, pathways, and conversions. But this time, I will have lost the initial source, the one that brought the visitor to my AMP. 

So, I would like to link these 2 environments and follow the user’s path regardless of his/her starting point, for example, with the AMP page as the landing page, its source of traffic, the subsequent pages on my site, and possibly conversions. To do so, I will use the same property for both environments.

However, hosted on a Google domain (CDN), the AMP immediately poses a multi-domain tracking problem. The cookie which allows Google Analytics (GA) to track the visit and the visitor is enabled on the site domain (1st party) and can’t be picked up one domain to another. Therein lies the real problem: GA is incapable of reconstructing the visit between the two environments: there will be a visitor on the AMP and then another new one on the classic site.

Solution

Thankfully, Google provides a solution to solve this problem.

It’s a matter of adding a tag in the AMP header:
<meta name=”amp-google-client-id-api” content=”googleanalytics”>
At first glance, no solution via GTM, one must use direct integration.

And also adding a parameter to all the other site’s pages’ GA tag:
ga(‘create’, ‘UA-XXXXX-Y’, ‘auto’, {‘useAmpClientId’: true});
If you use GTM, you can add this parameter in your GA tag.

As a result, GA will be able to reconstruct the visits and the visitors.

Be careful to add the Google CDN domain to the list of excluded referral sites so the AMP is not considered a referral when it arrives on your site which will replace the prior source. Here’s the domain: cdn.ampproject.org

As for me, I rename the page in the AMP analytics tag in the following manner: 
www.mysite.com/amp/landing1
My site’s domain is already excluded from the referral sites so the problem no longer exists.

And lastly, don’t forget to obtain the consent of your AMP users as you already normally do on your site!

This solution was presented as part of the AMP 2018 Conference

Update, 02 Mar 2018

Be aware that there is a notable consequence to using this configuration:
In visiting the AMP for the 1st time, a user who already has a GA cookie will have his/her ID overridden by this configuration. As a result, s/he will be considered to be a new user at that time. This will happen once and only if s/he visits an AMP tracked in this manner.

So, this configuration will temporarily affect the “new/known” aspect as well as other aspects of the user perimeter depending on your users’ frequency of visit. Among other affected dimensions, there is notably the “has already ordered” aspect, or possibly personalized dimensions such as newsletter subscriptions in GA.

Take this consequence into consideration if your visitors come frequently and if you use this data to analyze your data or for personalization purposes.

 

tags:

, , , ,

, , , ,

, ,

to read next...

Leave a Reply

Your email address will not be published. Required fields are marked *

0
0

Tracking AMP: Consolidating Visitors in Google Analytics