GCLID (Google Click Identifier) tracking is a unique tracking number that is added to each individual AdWords click. In effect, it identifies the very individual, their very advert, and further – the search term they used. It’s pretty smart. It’s pretty next level.

Let’s Start With Tracking with UTMs

UTMs have traditionally been the best way to track AdWords leads into an offline world. By offline world, we mean outside of your .com or landing pages – somewhere like a CRM. UTMs are usually added to a URL string placed into an ad.

Here’s one we created earlier…
(i.e stickyclick.co.uk/services/creative?utm_source=google-paid&utm_medium=campaign1234)

In this URL+UTM we reference both the source and the medium – the latter of which would be prefilled into a hidden field of a form. The UTM can be held into the URL and pushed through into a contact record on conversion, or held in a cookie and filled into a form when the contact returns (this is the better way).

In short:

  • UTM added to Google ad URL
  • UTM split out from URL and plonked into a hidden form field
  • Contact record contains UTM value
  • EQUALS – Pipeline tracking with offline reference to ‘source’ of the lead or opportunity.

Tracking with GCLID

It’s not unlike UTM tracking in terms of the way you set this up. GCLID is passed across in the URL, saved into a cookie, and then prefilled into a hidden field of a form. This GCLID number then accompanies the contact throughout their buying journey. Later down the line you can attribute that opportunity, that win, to a specific search term. The result, better-optimised campaigns!

How to setup GCLID Tracking

Ok, so let’s break this down. You’ll need to do five things to get this working.

  1. Enable auto-tagging in your AdWords account
  2. Set up conversions in your AdWords account (if you don’t do this you won’t be able to match GCLID tracking IDs against conversions)
  3. Create a cookie to drop the GCLID number of your click/contact onto their machine
  4. Add in a script that’ll retrieve the GCLID number from the cookie that you previously dropped
  5. Add in a hidden field to your form to collect the GCLID number of your contact when they finally fill out that flipping form!

So let’s begin

1. Enable Auto Tagging in preparation for GCLID

By default, auto-tagging is turned off. Turn it on to tell Google to add the GCLID to your advert URLs.

It’s dead simple to turn on.

  1. Sign into your Google AdWords account.
  2. Select “All Campaigns” on the top left-hand side of the screen
  3. Click on “Settings” on the bottom left side of the menu
  4. Make sure you select the “Account Settings” tab from the two tabs that appear at the top of the page.
  5. Pick the “Auto-Tagging” option and click on “Tag the URL that people click through from my ad” checkbox then just “Save“.

2. Set up Conversions in your AdWords account

This should seem pretty obvious but don’t forget to do it first, before rolling live with your campaigns. You’ll need conversions in place to later upload your GCLID numbers from your offline area – CRM or Marketing Automation software – to attribute conversions against your keywords. Note that you should wait 4-6 hours before uploading conversions after doing this.

3. Create a cookie to store the GCLID number

Let’s not get started on GDPR, and whether you’re asking your audience to consent or not. For the purpose of simplicity, let’s just presume all of your audience has consented!

To get this cookie to drop you’ll need to add some code to your website. It’s best to place this code right before your close </body> tag. This MIGHT be a pain for you depending on how your website is setup though. If you are using WordPress, a plugin such as WP Insert Code could do the trick for you. If you’re site is less flexible, then using Google Tag Manager may also be a good option. Tag manager can push any code onto your website via a trigger and means you don’t need to worry about adding it to new landing pages that you may build. Alternatively add it to your page templates if possible.

Here’s an example of the type of code that will need to be added to every page of your website (just before </body>). Note that depending on your site it may need some small adjustments.

<script type=”text/javascript”>
function setCookie(name, value, days){
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = “; expires=” + date.toGMTString();
document.cookie = name + “=” + value + expires + “;path=/”;
}
function getParam(p){
var match = RegExp(‘[?&]’ + p + ‘=([^&]*)’).exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ‘ ‘));
}
var gclid = getParam(‘gclid’);
if(gclid){
var gclsrc = getParam(‘gclsrc’);
if(!gclsrc || gclsrc.indexOf(‘aw’) !== -1){
setCookie(‘gclid’, gclid, 90);
}
}
</script>

4. Add code to lookup your GCLID Tracking number

The next step is to add a script to your website that will look up and find the cookie tyou have dropped onto the contacts machine, and pull out the GCLID number that you’ll use to identify them. It’s important that you add in this code AFTER the code above – otherwise for contacts that have literally just arrived, the script will run prior to the cookie being dropped – and so it won’t work!

<script>
function readCookie(name) {
var n = name + “=”;
var cookie = document.cookie.split(‘;’);
for(var i=0;i < cookie.length;i++) {
var c = cookie[i];
while (c.charAt(0)==’ ‘){c = c.substring(1,c.length);}
if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
}
return null;
}

window.onload = function() {
document.getElementById(‘gclid_field’).value =
readCookie(‘gclid’);
}
</script>

This script makes the presumption that the field in your form is called gclid_field. You can name it what you like though!

5. Add the hidden field into your form

Ok – nearly there now! To get your GCLID tracking code into your form you will want to create a hidden field. Name it what you like, though it must match the cookie script. In the above examples we are using the field name gclid_field. It makes sense and it’s easy to remember! You might add this field into your Marketo or Eloqua form builder, or directly into your html code. Note though, within our processing steps of your form you will need to map this form field to a field in your contact’s record – that way it will stay with them throughout the sales cycle.

Your code may look a bit like this:

<form action=”” name=”myForm”>
Name: <input type=”text” name=”name”>
<input type=”hidden” id=”gclid_field” name=”gclid_field” value=””>
<input type=”submit” value=”Submit Form” name=”btnSubmit”>
</form>

And that’s it, you’re done. The next step will be to export your conversions from your CRM or Marketing Automation platform, and upload them into Google. You can then count your exact conversations at every level.
You can now also see the exact Keywords that turned into an opportunity and hopefullky, a paying customer.