On this page
What this issue is
A click ID is a unique value an ad platform adds to your link when someone clicks an ad. Google Ads adds gclid (and sometimes gbraid or wbraid). Meta adds fbclid. The ID only exists in the URL of the first page the visitor lands on.
- Ad clickURL has ?gclid=abc123
- Landing pageID is in the address bar
- Next page / form pageID is dropped, no cookie saved
- Form submitHidden field is empty
- CRM contactNo click ID on the record
The ID is in the URL on landing, but nothing stores it, so the CRM record is created without it.
Why it costs you leads or sales
- Offline conversion imports to Google Ads, which need the gclid to match a sale to a click
- Meta conversion uploads that rely on fbclid to improve matching
- Reporting on which campaigns produce qualified leads and revenue, not just form fills
- Smart bidding signals, so the ad platform optimises for any lead instead of the leads that close
Example: share of paid leads in the CRM that carry a click ID before and after adding a hidden field. Numbers are illustrative.
How to check if your site has it
Open your site with a fake click ID
Visit your landing page with
?gclid=TEST123&fbclid=TEST456added to the URL, in a private window.Browse to the form
Click through to another page, as a real visitor would, then open the form. The ID is gone from the URL by now.
Inspect the hidden fields
Right-click the form, choose Inspect, and search for
gclid. The hidden input should showTEST123as its value.Submit and check the CRM
Submit the form with a test email, then open the new contact. The click ID field should contain
TEST123.
How to fix it
(function () {
var keys = ['gclid', 'gbraid', 'wbraid', 'fbclid'];
var params = new URLSearchParams(window.location.search);
keys.forEach(function (k) {
var v = params.get(k);
if (v) {
document.cookie = k + '=' + encodeURIComponent(v) + '; max-age=7776000; path=/; SameSite=Lax';
}
});
function getCookie(name) {
var m = document.cookie.match('(?:^|; )' + name + '=([^;]*)');
return m ? decodeURIComponent(m[1]) : '';
}
function fill() {
keys.forEach(function (k) {
document.querySelectorAll('input[name="' + k + '"]').forEach(function (el) {
if (!el.value) el.value = getCookie(k);
});
});
}
document.addEventListener('DOMContentLoaded', fill);
setTimeout(fill, 1500);
})();Add hidden fields to the form
In your form plugin (for example Gravity Forms, WPForms, Contact Form 7 or Fluent Forms), add hidden fields named exactly
gclidandfbclid. Some plugins let you set the default value to a URL parameter, which can replace the script.Load the script
Add the snippet site-wide with a header and footer plugin or your theme's footer.
Map to the CRM
In the form's CRM integration or webhook settings, map each hidden field to a CRM property.
Create URL variables
Add URL variables of type Query for
gclidandfbclid, plus first-party cookie variables of the same names.Add a Custom HTML tag
Paste the script as a Custom HTML tag that fires on All Pages. Check the consent settings on the tag.
Preview
Use Preview mode with a fake click ID and check the hidden input value in the page.
Add hidden inputs
Add an Embed element inside the form with
<input type="hidden" name="gclid">and the same forfbclid.Add the script
Paste the script in Project Settings, Custom Code, Footer Code, and publish.
Send to the CRM
Make sure the form's destination (webhook or integration) forwards these fields to the CRM.
Add hidden fields
In the form builder, add Hidden Field elements and set their query key to
gclidandfbclid. Link them to custom contact fields.Check on funnel pages
If the form sits on another page than the landing page, add the script in the funnel's tracking code so the value is stored first.
Add inputs
Put
<input type="hidden" name="gclid">and<input type="hidden" name="fbclid">inside every lead form.Include the script
Load the script on every page, not only the landing page.
Save server side
Read the two fields in your form handler and pass them to the CRM API as custom properties.
Create CRM fields
Create single-line text properties or custom fields called, for example, Google Click ID and Facebook Click ID.
Map form fields to them
Match each hidden field name to its CRM field in the form or integration settings.
Protect the value
Set the field so a later blank submission does not overwrite an existing click ID, where your CRM allows it.
How to confirm it's fixed
- Visit the landing page with ?gclid=TEST123 and see the cookie set in your browser's storage panel
- Open the form on a different page and see the hidden field filled with TEST123
- Submit a test lead and see TEST123 in the CRM click ID field
- Repeat with ?fbclid=TEST456 and check the Meta field
- Repeat on mobile and in a second browser
How to prevent it happening again
| Cause | What you see | Fix |
|---|---|---|
| No hidden field on the form | Field missing in page source | Add hidden inputs named gclid and fbclid |
| Field not mapped to CRM | Hidden field filled, CRM empty | Map it in the integration settings |
| ID only on landing page | Field empty on later pages | Store it in a cookie and fill from there |
| Redirect drops query string | No ID even on landing page | Keep query parameters in the redirect |
| Script blocked by consent | Cookie never set | Review consent settings for the script |
How FunnelGuard handles this
Questions people ask
Why is my gclid not showing in my CRM?
Most often there is no hidden form field to carry it, or the field is not mapped to a CRM property. The gclid also disappears if the visitor moves to another page before the form and nothing stored it in a cookie. Check the form's page source for a hidden input named gclid.
How do I capture gclid in a form?
Add a hidden input named gclid to the form. Use a small script to read the gclid from the URL, save it in a first-party cookie, and fill the input on any page. Then map the field to a CRM property.
Do I need the gclid for offline conversion tracking?
Yes, Google Ads offline conversion imports normally match a sale to a click using the gclid (or gbraid and wbraid for some iOS traffic). Without it stored on the lead, the sale cannot be matched to the ad click.
What is fbclid and should I store it?
The fbclid is a click ID Meta adds to links from its ads. Storing it with the lead lets you use it in Meta conversion uploads and trace a lead to a Meta click. It is worth capturing alongside the gclid.
How long should I keep the gclid cookie?
Many sites use 90 days, which fits Google's click window for conversion imports. Check your own privacy policy and consent rules, since a cookie like this may need consent in some regions.
Why is my hidden gclid field empty on the form?
The script may run before the form loads, the field name may not match, or the URL parameter was stripped by a redirect. Add a delayed fill, confirm the field name is exactly gclid, and test with a fake ID in the URL.
Does FunnelGuard check if the gclid reaches my CRM?
FunnelGuard checks the submitted form payload for the click ID values it arrived with. That shows whether the form sends them. Confirm the CRM field mapping yourself with a test lead.
Related issues
- TRK-270UTMs not written to CRM contact fieldsFix guide
- TRK-278Hidden UTM fields present but emptyFix guide
- TRK-279Hidden fields populated with literal placeholders ({utm_source})Fix guide
- TRK-277Lead source field overwritten on later visitsFix guide
- TRK-268HubSpot form submissions not linked to tracked visitor (hutk missing)Fix guide
- TRK-272GoHighLevel attribution source missing on contactFix guide