How to Track Offline Sales Using Gclid

 A Step-By-Step Tutorial 

What is a Gclid, and why does it matter?

This has got to be one of the oddest digital marketing terms in the industry, and one you may not be familiar with. Gclid is short for “Google Click Identifier“. Basically, it is a unique identifier that is appended to your URL (but you only view it internally, it won’t ruin the visual URL for your visitors). The Gclid uses auto-tagging to then follow these visitors around your site, tracking their data (how much time they spend on a certain page after clicking your ad, etc.).

It’s extremely efficient because you don’t have to manually set up tags for every URL, and it decreases the risk of making mistakes while tagging. Implementing Gclid allows you to sync your Google Analytics & Google Ads data, and also enable offline conversion tracking!

Offline sales tracking in Google Ads will change the way you manage your campaigns. Using the Gclid field will enable you to visualize revenue in your lead generation campaigns. All of your optimization will be towards ROAS (return on ad spend) rather than just the number of leads.

With this information, you can view offline sales data inside your Google Ads account, which will give you the opportunity to optimize for revenue, gain Ecommerce-level control of a lead generation campaign, and cut wasted spend.

When you aren’t tracking conversions, you’re essentially spending your budget blindly and on things that might not be getting you any results. It’s like going fishing without any equipment. You can’t see past the surface of the water to know where the fish are, and you’re relying on guesswork to catch them. But the experienced fisherman have fish finders; they know they perform better when they have sonar devices so they can see EXACTLY where the fish are. Gclid is your Google fish finder.

 

Sans Gclid Advertising

Gclid allows you to see exactly where to cast your bait (spend your marketing dollars)!

 

Let’s learn how to use it!

Step 1: Create an offline conversion goal

 

  • Navigate to “Tools” in your Google Ads account and select “Conversions”
  • Add a new conversion and select the type as “Import”
  • Choose the import sorce as “Other data sources or CRMs” and the sub selection as “Track conversions from clicks”
  • Give the conversion a name like “sale” and finish the prompts

We like to use a unique value for every conversion (unless your prices are fixed). We also like to count every conversion so that we attribute credit for the lifetime value of the customer. 

Step 2: Enable auto-tagging in your Google Ads account

 

  • Select the “Settings” tab from the left menu
  • Toggle the “Account Settings” tab
  • In the Auto-tagging bar, make sure the box is checked

Step 3: Update your website to save the Gclid in a cookie

 

IMPORTANT

Consult with your webmaster or IT team when completing this step. (The instructions and code below come straight from the Google Ads Help Center!)

 

  • Update the code on each of your web pages to capture and store the Gclid in a cookie.Here’s sample JavaScript code you can use on each web page to store the Gclid in a cookie named “gclid.”
    <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>

     

    
    
  • Google recommends that you place this code at the bottom of every page on your site, right before the closing </body> tag, so you do not have to add it each time you create new ads with new landing pages, or worry about losing Gclids if you change landing pages for existing ads. They also strongly encourage adding this code to your webpage template, so that all your new pages will automatically have the code and be able to capture Gclids (we second this). 

Step 4: Make sure your form passes the value with every lead

 

  • Adjust your website’s prospect lead information submission page (usually a form) to read the Gclid from the cookie and pass it along to your lead management system, along with the lead’s contact information. 
  • You can retrieve the Gclid value via your choice of client- or server-side languages. Once retrieved, Google recommends passing the Gclid through your lead submission form as a hidden field element.
  • Google provides an example form with a hidden field for collecting the Gclid. You should insert the highlighted <input>tag in between your <form> tags.:
   <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>
  • Here’s example JavaScript code you can use to retrieve the Gclid value from the cookie and update the value of the hidden form element. Google highlights that it’s important that you insert this code after the Gclid collection code in step 3 and before the closing </body> tag.
  <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 example assumes that you have a hidden field called ‘gclid_field’ in your form. If your field has a different name (for instance, if you have to use the name your CRM system created for you), then simply replace ‘gclid_field’ with that name.

Step 5: Find a lead converted to a sale

In your CRM or lead tracking system, find a lead that has converted to a sale from Google. Fill out the conversion upload template.

Step 6: Upload your conversion to Google Ads

 

  • Go to tools in your Google Ads account and select “Conversions”
  • Clicking on “Uploads” in the left-hand menu
  • Click the “Plus” button
  • From here, you can view the upload templates
  • Choose “Conversion” from clicks in your preferred file format
  • Enter your sales information and Gclid into the spreadsheet
  • Upload the file


    IMPORTANT

    Make sure you fill out the time zone in the conversion upload spreadsheet!

     

Step 6: Ensure the conversion was uploaded successfully

After the file is processed, Google will let you know if the upload was successful or if it had any errors. 

All finished! Now, you’re tracking offline sales.

Watch our video explanation to find more tips on this topic!