Skip to content
FunnelGuard

Fix guide by FunnelsGuard

gclid/fbclid not written to CRM: how to find and fix it

TRK-271High impactDetectedBy FunnelGuardPublished Updated
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.

Where the click ID gets lost
  1. Ad clickURL has ?gclid=abc123
  2. Landing pageID is in the address bar
  3. Next page / form pageID is dropped, no cookie saved
  4. Form submitHidden field is empty
  5. 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

What you lose without click IDs in the CRM
  • 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
Leads with a click ID storedExample numbers
Leads with a click ID stored (example)Before fix: 8 %; After fix: 92 %03571892Before fixAfter fix%

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

Test it by hand
  1. Open your site with a fake click ID

    Visit your landing page with ?gclid=TEST123&fbclid=TEST456 added to the URL, in a private window.

  2. 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.

  3. Inspect the hidden fields

    Right-click the form, choose Inspect, and search for gclid. The hidden input should show TEST123 as its value.

  4. 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

Capture click IDs and fill hidden fieldsjavascript
(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 the hidden fields on your platform
  1. 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 gclid and fbclid. Some plugins let you set the default value to a URL parameter, which can replace the script.

  2. Load the script

    Add the snippet site-wide with a header and footer plugin or your theme's footer.

  3. Map to the CRM

    In the form's CRM integration or webhook settings, map each hidden field to a CRM property.

Finish in the CRM
  1. Create CRM fields

    Create single-line text properties or custom fields called, for example, Google Click ID and Facebook Click ID.

  2. Map form fields to them

    Match each hidden field name to its CRM field in the form or integration settings.

  3. 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

Confirmation checks
  • 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

Common causes and their fixes
CauseWhat you seeFix
No hidden field on the formField missing in page sourceAdd hidden inputs named gclid and fbclid
Field not mapped to CRMHidden field filled, CRM emptyMap it in the integration settings
ID only on landing pageField empty on later pagesStore it in a cookie and fill from there
Redirect drops query stringNo ID even on landing pageKeep query parameters in the redirect
Script blocked by consentCookie never setReview 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.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: payload_contains.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.