Track Conversions With Google Analytics' Client ID

By Attributio | April 27, 2017

Introduction

Google Analytics is an underutilized tool and there are a few basic things you can do to gain more insight into your conversions. Last year in March of 2016 Google made their new User Explorer available to the public. It’s a great tool but unfortunately, you can’t drill down into other dimensions with this tool yet. Also, you can’t combine this information with other dimensions or metrics like where the user came from.

What the User Explorer essentially does is aggregate users based on the client id that google collects in the form of a cookie set in your visitor’s browser. Google uses this cookie internally but doesn’t make it accessible to Google Analytic’s users. The only way to access the client id is by exposing it and sending it to your Google Analytics property as a custom dimension.

Why You Need to Add Client ID Now

When you’re ready to start looking at where your conversions are coming from, you’ll want to connect the information related to where they came from and how they interacted with your site. Unfortunately, you wont have that data. And you’ll have to wait until you’ve collected enough data to make any kind of assessment on conversions.

Assuming that you are collecting your visitor’s client id when they convert, you can query as far back as you like on that user to visualize every step they took to convert. You can also view all of the channels that they navigated to before converting.

How to Add Client ID as a Custom Dimension

You can add the client ID as a custom diemsion in google analytics by navigating to the admin section of your account and selecting the web property you want to modify/


add custom dimension to google analytics


Select Custom Definitions / Custom Dimensions and click on the “New Custom Dimension” button.


add client id to google analytics


You want to add the name “Client ID” and set the scope to Session. You can add it as a Hit or User if you like but Session based granularity is appropriate since a session encompasses hits when a visitor interacts with your site and user based collection might miss some session interactions you’ll want to observe at a later time.


add session based client id to google analytics


Then you can set the custom dimesion value to your website according to the dimension id that google provides.


add custom dimension client id to website embed code


You’ll want to add the following code as an ammendment to the default embed code that Google Analytics provides. So if you have the default Universal Analytics snippet installed on your website, you’ll want to modify it like so:

Before

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-1', 'auto');
ga('send', 'pageview');

After

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXX-1', 'auto');
ga(function(tracker) {
  var clientId = tracker.get('clientId');
  ga('set', 'dimension1', clientId);
  ga('send', 'pageview');
});

Need Help Setting Up Your Custom Dimensions?

Sometimes it’s not always so simple to configure custom dimensions. Your developer may have set up your analytics in a custom way ot you might be using Google Tag Manager to manage all of your js snippets.

In that case, we have experts standing by to install your custom dimesions. Meet Your Expert Today!