5.1K members online now
Discuss discrepancies between AdWords and Google Analytics data, linking AdWords and Google Analytics, importing your goals/Ecommerce transactions into AdWords, and setting up Remarketing
Guide Me

How to pass gclid parameter manually in JS to Google Analytics

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I have a website build with one of the most amazing frameworks on the world. Unfortunately it has one downside. It does not allow to use query parameters, for example: is ok but is not ok. When you put this URL it uses browser history  so there is no query parameters left in URL.


I have a campaign in Google Adwords that directs users to this website. Auto tagging is on. I've noticed there are 10k clicks to my website, but Analytics does not report such number for Adwords source.


I discovered that Adwords auto tagging is adding gclid parameter to the destination URL. Than, Analytics knows everything about the campaign because Analytics and Adwords are linked together and i should have pretty analytics data on campaigns and their conversions.


But i don't have it. Since my one of greatest website frameworks removes with its JS code the gclid parameter, Analytics does not notice the gclid and not save the source of the user.


To check if it is really my great website framework issue, i've added utm(umt) parameters to my website and checked source in real time in Analytics. It was not reported as source i provided in parameters but a direct visit.


I would like to be able to analize Adwords performance in Analytics. I can not change unfortunately my framework because it is one of the greatest on the world. But i have noticed that before JS code of the framework is fired i have for a while a URL with the parameter gclid.


Some lines below i have my Google Analytics tracking code. Obviously it tries to get gclid from the URL. But it is too late for him. The gclid parameter is gone when Google Analytics tries to read it.


So my question is: since i have gclid, is there any method of Google Analytics to pass it to him? Like say:


var gclid = getGClidBeforeItsToLate(); // i have it covered


// Awesome framework stuff





1 Expert replyverified_user

Re: How to pass gclid parameter manually in JS to Google Analytics

Top Contributor
# 2
Top Contributor
To the best of my knowledge the gclid parameter is added by the adwords system
Are you able to provide a link to the applicable website, often its easier to troubleshoot if able to look
at the website code via browser.
What framework is the site built with?
Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here