AdWords
2.4K members online now
2.4K 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

GCLID to SalesForce

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi,

 

I'm currently using a 3rd party form (Contact Form 7) to pass our website's form fill data into SalesForce via Web-to-lead fields. This is working fine.

 

Now, I'm trying to pass the GCLID into a SalesForce field as well.

I've carefully followed the instructions here: https://support.google.com/adwords/answer/6299296  , 

and have managed to get this working for the most part.

 

My issue, is that it only seems to be working when a user is dropped off on the home page.  After landing on the home page, the cookie works as it should, sticking with the user as they browse pages until filling out the contact form. But when an AdWords link brings them to ANY page OTHER than the home page, the GCLID seems to get ignored on the form fill.

 

I've tested this multiple times by adding the parameter ?gclid="test" to the URLs and still can only get this to work from the Homepage.  I've tried checking for jquery conflicts or any additional scripts that may be causing hiccup but I've had no luck.. The scripts do seem to be firing correctly..

 

Does anyone have any insight or ideas as to what might be going on? Any help is appreciated!

 

-Kevin

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Kevin R
August 2016

Re: GCLID to SalesForce

Collaborator ✭ ☆ ☆
# 6
Collaborator ✭ ☆ ☆
Hi
Can you try document.cookie = name + "=" + value + expires + ";path=/"; instead of document.cookie = name + "=" + value + expires;
Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

View solution in original post

Re: GCLID to SalesForce

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆
Hello Kevin,

We experienced this working with a client that used Salesforce as their CRM and wished to capture the GCLID parameter for us to upload with an associated value later on.

The first thing you will need to do from the salesforce end is to make sure a hidden field is created that will look for the gclid parameter and capture it.

Second, if the issue is the GCLID is not passing through from the landing page into the Salesforce interface, it could be an issue with the parameter dropping. In the conversion process is there a domain switch? If so, use analytics to add additional domains to be excluded as referral sources. You may also need to add the GCLID script to your website to ensure that the parameter does not drop. This will need to be added to the body of the source code on every page of the website, at a minimum those pages that will be hit during the conversion process.

The script can be found here: <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;
}
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>

Let me know if this helps or if you are able to provide additional information.

Best,

Nick

Re: GCLID to SalesForce

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Nick,

Thanks for the reply.

I've created the hidden field in both Salesforce and my web form, I have the GCLID script on all pages of the site, and there is no domain switch at any point. The script/cookie works if a user lands on the home page - no matter how many pages they browse, the cookie captures this info and the gclid still populates into SalesForce when they fill out the contact form.
The issue is when they initially land on any other page (ie. product pages or specific landing pages) then the gclid doesn't get stored or passed through the form. I've tested this by appending ?gclid="test" to the end of our site's urls and it still only seems to work if we start on the home page.

Re: GCLID to SalesForce

Collaborator ✭ ☆ ☆
# 4
Collaborator ✭ ☆ ☆
can you post your URL?
Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: GCLID to SalesForce

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Sure thing,

(URL REMOVED)

Marked as Best Answer.
Solution
Accepted by topic author Kevin R
August 2016

Re: GCLID to SalesForce

Collaborator ✭ ☆ ☆
# 6
Collaborator ✭ ☆ ☆
Hi
Can you try document.cookie = name + "=" + value + expires + ";path=/"; instead of document.cookie = name + "=" + value + expires;
Regards, Nik
LinkedIn  |   @nikhilparachure | My Blog

Re: GCLID to SalesForce

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
You're the man, theniks! I've sent a few tests through and that edit seemed to fix the issue.

Any insight as to why adding + ";path=/"; fixed this? Just for my own understanding, if possible.

Thanks so much for the help guys!