How to Capture GCLID on Your Website (Step by Step)
The GCLID is the thread connecting an ad click to a sale that happens weeks later. Here is how to capture it so it is still there when you need it.

By the end of this post you will be able to capture the Google click ID on your site, store it so it survives a long sales cycle, and have it land on the right record in your CRM. That is the one piece of plumbing every offline conversion setup depends on.
Get it wrong and everything downstream fails quietly. You upload a hundred closed deals to Google Ads and it matches four of them, with no error message explaining why.
When this matters (and when it does not)
This matters if:
Your sales happen after the website visit. A call, a quote, a demo, a contract.
You run Google Ads and want it to optimise toward revenue rather than form fills.
Your sales cycle is longer than a few days.
It does not matter much if you are a pure ecommerce store where the purchase happens on site in one session. In that case a normal conversion tag does the job and the click ID is handled for you.
What the GCLID actually is
When someone clicks your Google ad, Google appends a parameter to your landing page URL that looks like this:
yoursite.com/landing?gclid=Cj0KCQiA…
That string is a unique ID for that specific click. Google knows which campaign, ad group, keyword and device it came from. You do not need to know any of that. You only need to hand the string back later, attached to a conversion, and Google does the rest.
Think of it as a cloakroom ticket. You do not need to know where your coat is hanging. You just need to not lose the ticket.
Step one: turn on auto tagging
None of this works without auto tagging, and it is off in a surprising number of accounts.
In Google Ads, open Admin, then Account settings.
Find Auto tagging and make sure it is enabled.
Save.
If it was off, no historical clicks have a GCLID and there is nothing to recover. Turn it on today, then start capturing.
Step two: capture it on landing
The parameter only exists on the first page someone lands on. Click through to a second page and it is gone from the URL. So you have to grab it immediately and put it somewhere that lasts.
The pattern is simple:
On every page load, read the URL for a gclid parameter.
If one is there, write it to a first party cookie.
If one is not there, leave whatever is already in the cookie alone.
That third rule is the one people miss. If you overwrite the cookie on every page load, a visitor who comes back a week later by typing your domain directly will wipe out the ad attribution that was sitting there. Your ads will look like they produced nothing.
Set the cookie for 90 days. That covers most sales cycles and matches the window Google Ads will accept an offline conversion in.
Step three: get it into your form
A cookie is no use if it never reaches your CRM. Add a hidden field to every form and populate it from the cookie when the page loads.
Two details that cause real problems:
Populate on page load, not on submit. Some form tools read their field values at render time and ignore later changes.
If your form is in an iframe, the cookie is not readable from inside it. Most embedded form tools let you pass values in as URL parameters instead. More on that here: adding hidden UTM fields to any form
Step four: store it somewhere permanent
The cookie is temporary. The CRM record is forever. Create a dedicated field on the lead or contact and write the GCLID into it at the moment of submission.
Then make sure it survives whatever your CRM does next. In Salesforce it has to carry through lead conversion. In Zoho CRM it can be lost by duplicate merging. Those are covered separately:
Capture the other click IDs while you are here
You will eventually advertise somewhere else, and adding each one separately means four rounds of CRM admin and four chances to get the field mapping wrong.
Do it once. Capture gclid, gbraid and wbraid, fbclid and msclkid in the same pass. There is a single script for it here: one script that captures every click ID.
Before you finish
Auto tagging is on in Google Ads.
Click one of your own live ads, submit a test form, and confirm the GCLID landed on the record. Not a simulated URL. A real ad click.
Confirm a direct visit a day later does not overwrite it.
Confirm the value survives whatever your CRM does when a lead becomes a deal.
Check the field is not truncated. GCLIDs are long, and a short text field will silently chop the end off, which makes it useless.
That last one catches people. A 50 character field looks fine until you compare the stored value against the URL.
FAQ
How long is a GCLID valid for?
You can upload a conversion against it for up to 90 days after the click. After that Google Ads rejects it. That is the hard ceiling on your sales cycle for this method.
What if the visitor clears cookies?
You lose it. That is why you write it to the CRM at form submission rather than relying on the cookie later. Once it is on the record, cookies no longer matter.
Can I get GCLIDs for past clicks?
No. If auto tagging was off, or you were not capturing, that data does not exist anywhere you can reach. Start now.
What if I do not have a CRM?
No CRM at all, and you want the simplest possible version? I wrote a full walkthrough of that for Stape using nothing but a spreadsheet: Google Ads offline conversion tracking without a CRM. Click to read it here.
Do I still need this if I use Enhanced Conversions?
They solve different problems. Enhanced Conversions matches on hashed customer data at the time of the web conversion. Offline conversion import matches a later outcome to the original click. Most lead generation businesses want both.
Need this built properly?
Click ID capture is the foundation, and it is the part that is usually quietly broken. I set up and repair tracking for ecommerce stores and lead generation businesses, so the numbers in your ad accounts match the money in your bank account.
Have a look at what I do, or book a call and we can go through your setup together.



















