AdWords
4.3K members online now
4.3K members online now
Use AdWords conversion tracking and reporting to measure your results. Have a question about Google Analytics? Post it here, on the Google Analytics Community!
Guide Me
star_border
Reply

Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

Please can someone help?

 

I am in the process of taking all the necessary steps to set up GCLID offline conversion tracking. I am following the instructions on this page https://support.google.com/adwords/answer/3285060

 

So far I have

 

  • Enabled the auto-tagging and other necessary parts in Adwords - I can see the GCLID query string when ads are clicked
  • Created the GCLID field in Sales Force - this can receive data and seems to be working correctly
  • Added the code that stores the GCLID in a cookie - I can see that the GCLID cookie has been stored by my browser
  • Added the hidden field that maps to the GCLID field in Sales Force - this passes through the data successfully
  • Added the code that pulls the value from the cookie and passes it to the hidden field - this is the bit that seems to be not working

Both bits of Javascript are saved just before the closing body tag, with the read.cookie function placed after the write.cookie. I have tried placing the read.cookie function in all sorts of differnet places but it is still not pulling the value from the cookie.

 

Below are the individual bits of code I am using:

 

<!-- Start of Adwords GCLID cookie write -->
<script type="text/javascript">
function setCookie(a,d,b){var c=new Date;c.setTime(c.getTime()+864E5*b);b="; expires="+c.toGMTString();document.cookie=a+"="+d+b}function getParam(a){return(a=RegExp("[?&]"+a+"=([^&]*)").exec(window.location.search))&&decodeURIComponent(a[1].replace(/\+/g," "))}var gclid=getParam("gclid");if(gclid){var gclsrc=getParam("gclsrc");(!gclsrc||-1!==gclsrc.indexOf("aw"))&&setCookie("gclid",gclid,90)};
</script>
<!-- End of Adwords GCLID cookie write -->

 

<!-- Start of Adwords GCLID cookie read -->
<script>
        document.onload = function getGclid() {        
             document.getElementById("00Nw0000003mz9Q").value = (name = new    
        RegExp('(?:^|;\\s*)gclid=([^;]*)').exec(document.cookie)) ?
        name.split(",")[1] : ""; }
        </script>
<!-- End of Adwords GCLID cookie read -->

The bit in red is the name and ID of the GCLID field in Sales Force

 

And here is the hidden field part:

 

 <!-- Start of Adwords GCLID hidden field -->

<input id="00Nw0000003mz9Q" name="00Nw0000003mz9Q" type="hidden" value="" />

 <!-- End of Adwords GCLID hidden field -->

 

Has anyone else encountered this and has advice on how to fix it? Any help would be much appreciated.

 

Thanks in advance,

 

Cristian

 

 

 

 

 

 

2 Expert replyverified_user

Re: Help with GCLID offline conversion tracking setup

Top Contributor
# 2
Top Contributor
Hi,

I've mentioned over here: https://www.en.adwords-community.com/t5/Measure-results/Help-with-tracking-AdWords-offline-conversio... that you could use some assistance (googlers are responding to specific questions there regarding offline conversion tracking). That thread may also have some info you may find appropriate.

-Tommy

-Tommy
Tommy Sands, AdWords Top Contributor | Community Profile | Twitter | Philly Marketing Labs
Did you find any helpful responses or answers to your query? If yes, please mark it as the ‘Best Answer.’

Re: Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks Tommy,

I have taken a look and see that you pointed someone to this thread as well - much appreciated.

Re: Help with GCLID offline conversion tracking setup

JD Google Employee
Google Employee
# 4
JD Google Employee
Google Employee
Cristian, have you tried using the Javascript from our FAQ?
https://support.google.com/adwords/answer/2998031

If that doesn't solve the problem, please re-post this question on the thread that Tommy shared with you.

Jon

Re: Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Thanks for your reply, Jon.

The javascript given on this page https://support.google.com/adwords/answer/2998031 is different to the javascript given on this page (step 3) https://support.google.com/adwords/answer/3285060

I was using the latter because it looked more specific and wasn't labelled as example code. I will try the code on the page you suggested. Would you be able to indicate which parts of the code I need to change to match my hidden field name?

Thanks in advance



<!--


&lt;script&gt;
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').value =
readCookie('gclid');
}
&lt;/script&gt;
--!>

Re: Help with GCLID offline conversion tracking setup

[ Edited ]
JD Google Employee
Google Employee
# 6
JD Google Employee
Google Employee

We'll look into the code sample you used. In the meantime, look at the <input> tag for the new, hidden gclid field. Find the ID value, and substitute it in for the xxx below. Remember to enclose it with apostrophes.

document.getElementById('xxx').value

Jon

Re: Help with GCLID offline conversion tracking setup

Top Contributor Alumni
# 7
Top Contributor Alumni

HI

Can you post your URL here so we can take a look at your code?

 

Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
top r,
1. So you are saying the coockie contains the GCLID, correct?
2. can you make the gclid field not hidden (e.g. type="text") and double check the GCLID is not written from the cookie to the field (so the field is blank).
Other things to check:
Please use Chrome and enter this code in the developer console:
alert((name = new RegExp('(?:^|;\\s*)gclid=([^;]*)').exec(document.cookie)) ? name.split(",")[1] : "no gclid in cookies" );
Does it prompt you with the gclid?
What happens if you enter this in the developer console:
alert(document.cookie);
Is there a gclid cookie among the cookies of this page?

Also is there a way to share your contact form so I can take a look at it?

Alex

Re: Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭
Thanks for your responses. Here is the source code of the form page:

view-source:http://www.springfair.com/page.cfm/Link=133/

The GCLID cookie write/read codes start at line 959

Alex,

Yes, I can find the cookie in my browser. I have previously made the field not hidden and the cookie was not written into the field. I tried both those things you suggested in the javascript console and both times it found the cookie. It must be the javascript that writes to the field that is not working.

Thanks again for your help.

Re: Help with GCLID offline conversion tracking setup

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭
top r, did you manage to resolve your issues? Thanks for an update.

AK