How To Track Acquisition Dimensions in Google Analytics via GTM

Learn To Track "Acquisition" Custom Dimension in Google Analytics - GTM

Last Updated on April 18, 2019 by Ritwik B

Recently, It got me to thinking what matter’s the most the first attribution Or the last attribution?

Well, it depends…

The first attribution might not be relevant. Avinash Kaushik in his article here quotes,

 

First click attribution is like giving my first girlfriend 100% of the credit for me marrying my wife.

Well, that might be right in a certain way but what if the first impressions you made to those girls were in a totally different scenario. Let’s say

  • The first girlfriend saw you in a college, smoking or doing drugs with your friends. (that’s why rejected you)
  • The second girl (who became your wife) saw you in a seminar speaking in front of huge audience. (& it was mind blowing..!!)

Got the difference??

The point I am trying to make is sometimes first impressions matters & it matters a lot.

There are users who are impressed by – “reading one or two of your awesome articles OR by going through HQ images of various e-commerce products” & that’s why they return & later, become your subscribers/leads/customers.

You might have read lots of blogs on the web but there’s always that one article which strucks a chord in your head & you end up subscribing.

As per Kinesisinc, here are some stats:

  • First impressions are 94% design-related
  • Positive first impressions lead to higher satisfaction
  • First impressions can last for years

 

Now, getting back to our main goal of the article, we would be tracking 6 Acquisition Dimensions in google analytics via GTM. They are

  1. Acquisition Source.
  2. Acquisition Medium.
  3. Acquisition Campaign.
  4. Acquisition Landing Page. (My personal fav..!!)
  5. Acquisition Date.
  6. Acquisition Month. 

This information will give you some of the initial stats about the user

Some of the answers you’ll get from these dimensions are

  • Which Articles/Product Pages lead to more goal conversion rate?
  • What was the Landing Page URL of the Transacted Customer?
  • What was the Acquisition Source/Medium/Campaign of high LTV customer?
  • What was the Acquisition Date of High-Value Purchase? How many days did it take for a customer to convert? (like Days to Transaction)
  • What was the month where we acquired High LTV users?

& you can deep dive in more…

Acquisition Custom Dimension in Google Analytics

Follow The Step by Step method using GTM

Start by creating a custom HTML tag & fire the following code on all pages. Here’s the logic for the below

  • When the user lands on your website for the first time, the cookie named ‘ds_utm’ is stored with a 180 days duration. (Can be edited). The Cookie will contains information about the
    • Acquisition landing page
    • Acquisition date
    • Acquisition source / medium / campaign
  • Later, when the same user visits your website, the code will check for the cookie ‘ds_utm’. It will extract the values & use it to populate the dataLayer
  • Trigger it on all pages
  • Try visiting your website by doing a google search.
  • Turn on the GTM debugger after you land on the website.
AcquisitionCustomDimension_-_GTM

You will see the following variables populated in the dataLayer object

  1. Acquisition Source
  2. Acquisition Medium
  3. Acquisition Campaign
  4. Acquisition Landing Page
  5. Acquisition Date
  6. Acquisition Month

 

If you have used UTMs, that’ll too get captured

  • utm_source: will get captured as Acquisition Source
  • utm_medium: will get captured as Acquisition Medium
  • utm_campaign: will get captured as Acquisition Campaign

Now the next step is to create a dataLayer variable.

  • Go To GTM Variables
  • Create a variable of type dataLayer
  • Input the correct key values from the dataLayer object
AcquisitionLandingPage - GTM
AcquisitionSource_-_GTM

Next, create custom dimensions in google analytics. You can use

  • User Or Session Level Dimension
  • Hit level Dimension.

If you want to attach acquisition info only for certain hits (say event hits), you can use hit level custom dimensions. If you want to attach it to all hits, use user or session level scope.

In fact, the GTM dataLayer would be populated with acquisition info on every page load & that info won’t change unless the cookie expires (or gets deleted).

So you are free to customize as per your requirement.

Finally, you can create a Google Analytics Non-Interaction hit tag to fire on

  • Event Trigger – ‘firstAttribution‘.
AcquisitionCustomDimension_-_First_Attribution_-_Google_Analytics_Event
Acquisition_Custom_Dimension_-_Google_Analytics

In the above setup, I have used {{Acquisition Source}} / {{Acquisition Medium}} as a custom dimension. You can even combine other GTM variables as per your requirements.

After a while, you can check your reports. Use the above custom dimensions with

  • Custom Reports Or
  • Secondary Dimensions Or
  • GA APIs

Here are some Custom reports with Acquisition Dimensions

Acquisition_Source___Medium_-_Google_Analytics_-_GTM

In the above reports,

  • You can see which initial articles/blogs are giving you more goal conversion rate?
  • Which acquisition source is driving more goals? & so on…

You can even use Secondary Dimension on other reports.

Acquisition_Dimensions_-_Google_Analytics

Now that you have successfully implemented the setup, why not send the same information to facebook.

You can utilize facebook custom events to send the data. Create another tag with the following code & use the same event trigger.

<script>fbq(‘trackCustom’,’Button Clicks’,{‘acquisitionSource’:{{Acquisition Source}},’acquisitionMedium’:{{Acquisition Medium}},…….so on})</script>

Important Points

  • The Cookie value is base-64 encoded while storing. You can open your browser debugger & search for the cookie named ‘ds_utm’.

AcquisitionDimensionCookie - base64encoded

  • Lifetime value does offer some acquisition dimension but still cannot be used in custom reports or via APIs.

Audience-LifetimeValue_Reports_-_Google_Analytics

  • Make sure to have a non-interaction event hit, else it will skew some of your metrics.
  • Use proper custom dimension scope.
  • You can utilize the new acquisition dimensions in Custom Reports,as a secondary dimension or via APIs.

Ritwik is a Web Analyst & Product Marketer. He loves to write technical & easy to understand blogs for Marketers & Entrepreneurs. Focused on Google Analytics, Facebook Analytics, Tag Management, Marketing & Automation Scripts & more. Google Certified Professional. A Firm Believer in Teaching -> Learning -> Growing. :)

Comments (5)

  1. Hi Ritwik,

    I’ve just tried this on my own website and it works!

    Just a question about when this should be firing:

    Should I put a blocking trigger on so it doesn’t fire everytime the same user visits? EG: Do not fire event if DS_UTM cookie has been set.

    I’m wondering if I only want to collect data about first acquisition once per user otherwise it’ll inflate this metric??

    1. Hi Tom,

      Yes :), you can put a blocking trigger but make sure the scope of the dimension is ‘user’. (so the acquisition data will automatically get attached to all the current & subsequent sessions).

      Sending event data with ‘Hit’ level custom dimension (for every hit) will inflate ‘total events’, else it is similar to
      Sending event data with ‘User’ level custom dimension (for a single hit).

      Source: https://support.google.com/analytics/answer/2709828?hl=en

      Thanks,
      Ritwik

  2. This works great, thanks!

  3. Thanks this is really useful.
    I would like also to track the following UTM’s :

    utm_content
    utm_term

    as they help me better understand the type of keywords that drove traffic to the site (a more granular way to better understand my audiences)

    can you please advise how to update the code to pull these utm’s.

    Thanks.

  4. Hi Ritwik, nice article!
    By the way, don’t you know if that is possible to store acquisition data only on site1 (example.com) site and store it’s initial value in case if customer is moving to site2 (example.net)?
    When customer visits google.com -> example.com, example.com -> example.net, is that possible to avoid changing initial acquisition data when moving from example.com to example.net (value is changing from google to example.com)?
    Thank you so much!

Leave a Reply

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