Your Favourite Story
The Strategic Analytics Consultancy

Your Favourite Blog

The most excellent strategic marketing and web analytics blog from Your Favourite Story.

Implementing Adobe Analytics with Google Tag Manager (GTM)

This article oulines how you can implement Adobe Analytics tracking in Goole Tag Manager (GTM)

Introduction

I know the whole premise of this article initially sounds a bit bonkers given that Adobe does have its own Tag Management solution (DTM), which is soon to be deprecated in late 2019 by Adobe Launch. However, as a Digital Analytics Agency we have tended to find it quite common that Google Tag Manager (GTM) is used as the primary tag management tool within a business and it is often required to have Adobe Analytics shoehorned into it. 

This typically seems to be primarily down to two reasons: 

  1. Legacy - They have had GTM previously to manage all other third part tags, so it makes sense to use GTM for Adobe tags as well rather than thrown another tool into the mix. 

  2. Easy to use - It’s a very good widely used free tool and the learning curve is relatively easy,  meaning it’s easier to find people who are skilled in the tool, where as DTM tends to me a nore niche harder to find skill. 

In this article I’m going to cover some of the main steps required for getting up and running with GTM and Adobe Analytics. This post will be exploring more about how to implement Adobe Analytics Page Load tracking with Google Tag Manager. I’m not going to cover the setting up of the Data Layer, this is something I may cover in a later article if there are requests. 

 

Why should I even bother using a Tag Management Tool? 

Using a Tag Management is an absolute game changer in terms of cost and time saving for managing the data quality and collection on your digital assets. Primarily leveraging such a tool avoids going through the cumbersome and slow process of going through the IT/Tech/Dev-Ops team.  Amazingly, we typically find that only 75% of organisations/businesses are using some Tag Management solutions (This is data collected from some of the technical benchmarking/audits we have performed in the past); That’s 25% of companies that are suffering for no reason. 

If you are asking the question, we already have a process for hardcoding analytics tracking, why are you bothering to work through GTM for Adobe Tracking? 

Well here are a few key reasons: 

  1. We know exactly what tags are implemented and where they are implemented. 

  2. There is no need to use a developer to implement the tracking and then having to test it is working.

  3. I f there are any changes to pages or changes to tracking, we can implement the changes ourselves, saving time and cutting out errors.

  4. M ost importantly, this is a method of implementation that can save you time and money!

     

So now we know why, let’s move on to the how. 


Steps to implementing the tracking. 

  1. Download the Adobe Analytics Tracking Code 

  2. Make the Tracking Code Available on Your Site. 

  3. Configuring the Adobe Custom HTML Tags. 

  4. Setting up Tag and Triggers in GTM  

 

Step 1 - Download the Adobe Analytics Tracking Code from the Code Manager. 

First of all, you are going to need to get, or make sure you already have the two below JS files. 

VisitorAPI.js - This is important as it sets the Adobe Marketing Cloud ID (MCID) that replaced the Visitor  ID a few years bacl, the MCID is important as it is the common key that lets all the Adobe Tool recognise the user (so you can share customer segments between the various tools) 

AppMeasurement.js (Formerly the s_code) - This is the piece of code that effectively initialized and transmits the tracking object to the Adobe servers via a tracking request. 

You can get these files by logging into the Adobe Portal and then you can find it (see screen shot below) under Analytics > Admin > Code Manager. Just an FYI you’ll find a few file in there, make sure you grab the right ones. 

 

 

You can find a much more detailed explanation of this process on the Adobe Support Pages, and information on the Code Manager Here.

There are other versions of AppMeasurement for PHP but for now we will just stick the Javascript implementation. 

 

Step 2 - Make the AppMeasurement.js and VisitorAPI.js available on your site. 

As these two files are required for making a success call to the Analytics you need to make sure they are loaded before any analytics requests are populated or sent, there are two options available, and this is largely a design choice depending on your current Analytics set up. 

 

  1. Host the JS files on the Web Server – In this option you will need to get a developer to add the files to an accessible folder on the Server, then you can reference it as www.yourdomain.com/tracking/AppMeasurement.js, and www.yourdomain.com/tracking/Visitor_API.js, you can then refer to these on a page load. 

  2. Add the files as a Custom JS within GTM itself –  Effectively you are copy and pasting the content of the above files into a custom JavaScript tag in GTM, and then configuring these as custom HTML tags in GTM, I’m not going to cover this one in the post as you will likely need to set up tag sequencing and isn’t that straight forward. 

 

Now, I personally go for option one, I know that’s quite controversial, but I have found that just having these files hosted on the web server and use them as the reference makes it easier to maintain consistency of tracking. Typically, there could be multiple implementation and GTM containers in use at any one time, primarily due to legacy reasons. In an ideal world, we would just have one container, and the tracking script hosted in that one location, however, from a management point of view I find that rarely practical. 

 

Step 3 - Configuring the Adobe Tags 

Again, as there is no Adobe Analytics Configuration in GTM, we are going to have to leverage the Custom HTML Tags. Now in this example, it’s going to make it a lot easier if you use Data Layer Variables to dynamically populate value in the Tag, so I am going to leave them in as if I have done that, you can spot them as they are in the double curly brackets . This way you are only going to use a handful of tags and your implementation is going to be a lot more robust. 

 There are two types of tags fires in adobe, Page Views, and Link Clicks, these are transmitted by the s.t() and s.tl() functions respectively. 

3.1 - Page Views. 

Go into GTM and create a Custom HTML Tag, call this PV -  Adobe, then copy and paste the below code into the window (or at least something similar). 

I have put some generic values in to give you an idea but this should be bespoke to the values you want to fire in your implementation, this important part to note is the everything above the s.tl() is setting the parameter valeues, and the s,tl() function is creating and transmitting the request to the Adobe Servers. 

*Note* - You can see how I have referred to the two scrips in the Page Load tracking script itself, you could alternatively get your developer to load these two, if it’s for example a single page application or something, that’s a design decision you are going to have to make 


<script src= www.yourdomain.com/tracking/Visitor_API.js ></script> <script src=www.yourdomain.com/tracking/AppMeasurement.js></script> 
<script> 
s.server=; 
s.pageName={{Page Name}}; 
s.hier1=s.pageName; 
s.channel=; 
s.eVar1="D=1"; 
s.eVar2="D=c2"; 
s.eVar3="D=c3"; 
s.events="event202"; 
var s_code=s.t();if(s_code)document.write(s_code); 
</script> 

 

3.2 - Link Clicks 

This is very similar to a Page View tag, however there are some important difference, below is an example of a link click tag, differences to notice are you need to add in the s.linkTrackVars line, and list all the values you need to be transmitted to in the server call. Also the s.tl() function is called slightly differently, more details can be found on that here as is out of scope for this article, just that the extra parameter in the function is effectively identify the type of click 

*Note* - You should not need to load the tracking scrips for this type of request as click events come after a page load so they should  

<script> 
s.linkTrackVars="prop1,prop2,prop2" 
s.prop1= {{Click ID}; 
s.prop2=; 
s.prop3= ; 
s.tl(true,'o',{{Click ID}}); 
</script> 

 

Step 4 - Putting it all together 

Now we have our necessary components, the Analytics Tracking Scripts, and Tags that set and transmit the server call to Adobe, now we need to put that all together, for the below example I am going to use the out-of-the box  Page View trigger and transmit a Page View Trigger. Once you set up the tag with trigger it should look something like the below.  

Test this in preview mode to check it works then push it live then lie back and Basque in your Adobe/GTM glory. 

The above is showing an Adobe Analytics Custom HTML Page View Tag and associated All Pages Trigger - This tag will fire on every page.

The above is showing an Adobe Analytics Custom HTML Page View Tag and associated All Pages Trigger - This tag will fire on every page.

 

Conclusion 

So, this is just a bit of a rough and ready guide to hopefully provide you some bread crumbs to get going on this. It’s by no means a comprehensive guide as all builds are slightly different. I may expand on some of these in other posts. 

 

If you have any questions or any amends changes to this then feel free to drop me an email: Phillip.law@yourfavouritestory.com 

Julian MitchellComment