Adwords Offline Conversion Tracking

Let's start

Google Adwords recently released an ability to record offline conversions. Doing this in the past was a mess requiring lot of custom code and integration with backend crm system. The new method is much more straight forward not to mention officially sanctioned :). Below is meant as technical intro to the implementation. For all the steps to follow please review the support page

There are 3 main steps to the integration. 1- First you need to add this script to all pages. This detects whenever a user comes from adwords and stores their ad click id (gclid) in a cookie.

Add this code before closing /body>

<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> 

2- The forms on the site need to be updated with a new form field. This field would be hidden on the form itself and a script would be added to the page that will autopopulate it with a google adwords id (gclid).

If you are using a crm / email system like salesforce, infusionsoft, aweber you will need to add the new field in their backend and map it to the new form field.

Set the id of the new form field you created to gclid.

<input type="hidden" id="gclid" name="gclid" value="">

Add this script before /body> on the form page(s).

 <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 will autopopulate the new field with gclid.

3- On the backend in your crm you will need to generate a report of people who have converted and have the gclid set this data would then be added to a csv file according google’s format and uploaded it to adwords.

This makes it much easier to import offiline conversion data into adwords the actual formatting and upload could be automated as well making this even simpler (this is something we are cooking on for a client, stay tuned)

Don't miss out when new resources launch

Our customer analytics experts share wisdom only once a month

Share now
We are customer-analytics consultancy that transforms messy data into actionable insights that will help you grow your company and make better data-backed decisions.