1

I made a form in our website with hidden fields for tracking and saving Google Analytics Client ID and Google Adwords Click ID. I grab both ID's with 2 scripts and put them into my hidden fields and save them on my server.

When a user visits the website by organic traffic only the Analytics ID will be saved and send to Google, no problem.

But when a user visits my website by Adwords advertising, my website grabs both ID's.

The scripts for saving the id's:

<script type="text/javascript">

// Set gclid Cookie
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;
}
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);
    }
}

// Save gclid Cookie
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');     

} 

// Analytics Client ID in hidden field
$(document).ready( function() {
// Makes use of the Universal Analytics API 'ga' object
ga(function(tracker) {
    var clientId = tracker.get('clientId');     
    $("#clientid_field").val(clientId);     
    });
});

An example of the 2 saved id's

Google click ID and Client ID

We send the ID's to Analytics and Adwords with a revenue to measure offline conversion, but my question is: Does the 2 ID's conflict each other when you both send them to Google, so you got double measuring?

1
  • When you say you "send the IDs to Analytics and AdWords" what do you mean? Are you using the AdWords offline conversion feed service (conversion Import)? If so, that's not a problem as it only reads the Click ID.
    – jond
    Commented Apr 17, 2015 at 6:12

1 Answer 1

0

What do you want to track with adwords tracking code? if you have analytics and adwords accounts linked you just need to have analytics code in and set autotagging preference on (in adwords) or use utm codes to define campaigns, content, terms, etc.. https://support.google.com/analytics/answer/1033867?hl=en

2
  • I have set autotagging. But I'm not sure that you can only use client id for optimal conversion data. What is the reason that Google has made ​​gclid?
    – Robbert
    Commented Dec 11, 2013 at 8:55
  • they made it to track each individual visits. You can use it to check if adwords/analytics link is working on client side or if you want to analyse the separate visit. support.google.com/analytics/answer/2938246?hl=en Commented Dec 11, 2013 at 11:36

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.