On this page
What this issue is
When someone clicks a Google ad, Google adds a gclid (Google click ID) to the landing page URL. Meta adds fbclid in the same way. These IDs are what let the ad platform match a later sale in your CRM to the original click. This is called an offline conversion import.
The issue is that the ID is in the URL when the visitor arrives, but is not on the contact or deal record when the lead is created. Common reasons: no hidden field on the form, the ID is lost when the visitor moves to another page, a redirect strips it, or the CRM has no field to receive it.
Why it costs you leads or sales
Without the click ID, you can't tell Google Ads or Meta which clicks turned into paying customers. Smart bidding then optimises for form fills, not revenue, and keeps paying for clicks that never close. Reports show leads but not which campaign produced the sales.
- Ad clickURL has ?gclid=...
- Landing pageID is in the URL
- Form submitNo hidden field, ID not sent
- CRM recordgclid field empty
- Offline importNo match for the sale
The ID is present on landing but never reaches the CRM, so the closed deal can't be sent back to the ad platform.
Example: of 40 deals closed from paid leads in a month, only those with a stored click ID can be imported back.
How to check if your site has it
Visit your landing page with a test ID
Open the page in a private window with ?gclid=TEST123 added to the URL, for example https://example.com/landing?gclid=TEST123.
Navigate and submit
Click through to your form page like a normal visitor, then submit the form with a test name and email.
Open the CRM record
Find the new contact or lead and look for a gclid property. It should read TEST123.
Check webhooks too
If the form sends data to the CRM through a webhook or Zapier-style tool, view the request payload and look for the gclid key.
Repeat for fbclid
Do the same with ?fbclid=TEST456 if you run Meta ads.
How to fix it
The fix has three parts: save the ID when the visitor lands, send it with the form, and give the CRM a field to hold it. Start with the script, which works on any site.
(function () {
var params = new URLSearchParams(window.location.search);
['gclid', 'fbclid'].forEach(function (key) {
var value = params.get(key);
if (value) {
document.cookie = key + '=' + encodeURIComponent(value) + '; max-age=7776000; path=/; SameSite=Lax';
}
});
function getCookie(name) {
var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
return match ? decodeURIComponent(match[1]) : '';
}
document.addEventListener('DOMContentLoaded', function () {
['gclid', 'fbclid'].forEach(function (key) {
document.querySelectorAll('input[name="' + key + '"]').forEach(function (el) {
el.value = getCookie(key);
});
});
});
})();<input type="hidden" name="gclid" value="">
<input type="hidden" name="fbclid" value="">Add hidden fields
In your form plugin (the exact name depends on the plugin), add hidden fields named gclid and fbclid. Some plugins let you fill them from a URL parameter or cookie; otherwise use the script above.
Load the script on every page
Add the script through a header and footer code plugin or your child theme so it runs on the landing page, not only the form page.
Map to the CRM
In the form's CRM integration or webhook settings, map the hidden fields to your CRM properties.
Create cookie variables
Add a Custom JavaScript tag with the script above, firing on All Pages. Then create 1st Party Cookie variables named gclid and fbclid.
Respect consent
Fire the tag according to your consent setup, as click IDs can be treated as marketing data in some regions.
Add hidden inputs
In the form block, add custom embed hidden inputs named gclid and fbclid.
Add the script
Paste the script in Project Settings, Custom Code, Footer code, then check the submission in Forms or your webhook.
Add hidden fields to the form
In the form builder, add Hidden Field elements and set the query key to gclid and fbclid. Map them to custom contact fields.
Create the custom fields
Under Settings, Custom Fields, create text fields for each ID so the form has somewhere to write them.
Use Velo or a form with hidden fields
Wix's standard form may not offer hidden fields in every setup. Check your form app, or use Velo to read the URL query and send it with the submission.
Inject the script
Add the script under Settings, Advanced, Code Injection. Native forms may not take hidden fields, so check whether your form block or a third-party form supports them.
Persist on first landing
Use the script above on all pages, include hidden inputs in the form and read them in your server handler.
Send to the CRM
Add the values to your CRM API call under the property names you create there.
Create the properties
Add single-line text fields called gclid and fbclid on the contact, lead or deal object. In HubSpot these are contact properties; in Salesforce they are custom fields on Lead and Contact. Use the same field name on the lead and the converted contact so the value carries over.
Map the form fields
Match each hidden field to its CRM property in your integration, native connector or webhook.
Check redirects
Make sure redirects and link tools keep the query string, otherwise the ID is gone before the script runs.
Use the ID in your import
Export the stored gclid with the conversion time and value to Google Ads offline conversion import, or send fbclid-based data to Meta, following each platform's current requirements.
How to confirm it's fixed
- A submission made after visiting ?gclid=TEST123 shows TEST123 on the CRM record
- The value is still there when you browse to another page before submitting
- The value is exact, with the same case and length
- fbclid is stored the same way
- Webhook payloads contain the gclid key
- A visit without a click ID leaves the field blank and the form still submits
How to prevent it happening again
This usually breaks quietly after a form rebuild, a theme change, a new redirect or a CRM field rename. Re-test after any of those changes.
- Include the click ID test in your release checklist for forms and landing pages
- Don't rename or delete the CRM properties without updating the mapping
- Review redirects and link shorteners for query string loss
- Keep the capture script on all landing pages
- Run a scheduled check that submits a tagged test lead
How FunnelGuard handles this
FunnelGuard detects this today. A robot visitor runs your lead form journey on a schedule, from the EU or the US, with a test click ID on the landing URL. It then checks whether the gclid shows up on the CRM contact, and for webhooks it checks that the request payload contains the click ID.
If the check fails, it is re-checked from a second region before one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) and never clicks real ads. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.
Questions people ask
Why is my gclid not showing in my CRM?
Usually the form has no hidden field for it, or the ID is lost before the form is submitted. Redirects that drop the query string and a missing CRM property or mapping are other common causes. Test with ?gclid=TEST123 and trace where it disappears.
How do I store the gclid in my CRM?
Save the gclid from the landing URL into a first-party cookie, add a hidden field named gclid to your form and fill it from the cookie. Then create a text property in your CRM and map the form field to it.
Do I need the gclid for Google Ads offline conversion imports?
Yes, for click-based imports Google Ads needs the gclid to match a conversion to a click. Without it you would need another supported matching method, such as enhanced conversions for leads, which uses hashed customer data.
How long should I keep the gclid cookie?
A common choice is 90 days, as in the script above, but the right length depends on your sales cycle and Google's import time limits. Check the current Google Ads rules and your own consent and privacy policy.
Why does the gclid disappear when visitors move to another page?
The ID only exists in the URL of the first page. If you don't save it to a cookie or storage, the next page load loses it. Redirects that remove query strings cause the same problem.
Is fbclid handled the same way as gclid?
The capture method is the same: read it from the URL, store it, send it in a hidden field and save it in a CRM property. How you send it to Meta afterwards follows Meta's own requirements, which can change.
Can I test this without real ad clicks?
Yes. Add a made-up ?gclid=TEST123 to your landing page URL and submit a test form. Check the CRM record, then delete it. Don't upload fake IDs to an ad platform.
Can FunnelGuard tell me if the gclid is missing from my CRM?
Yes. FunnelGuard submits your lead journey with a test click ID, then checks the CRM contact for a gclid and, for webhooks, whether the payload contains it. You get an alert if it is missing.
Related issues
- DLV-077HubSpot contact created without UTM / original sourceFix guide
- DLV-078HubSpot form submission not attributed to the pageFix guide
- DLV-088Fields unmapped: phone lands in notes or nowhereFix guide
- DLV-097Consent/marketing opt-in field not passed to the CRMFix guide
- DLV-100CRM custom field deleted or renamed, sync errorsFix guide
- DLV-076Contact not created in the CRM after submitFix guide