If your sales close offline, you need the ad click ID stored with the lead. Otherwise you can't upload the sale back to Google Ads or Meta later. The capture is a few lines of JavaScript.
The idea
- Read the click ID from the landing page URL.
- Save it in a first-party cookie so it survives navigation.
- Put it in a hidden field on every lead form.
const params = new URLSearchParams(window.location.search); ['gclid', 'gbraid', 'wbraid', 'fbclid'].forEach((key) => { const value = params.get(key); if (value) { document.cookie = `${key}=${encodeURIComponent(value)}; path=/; max-age=7776000; SameSite=Lax`; } }); function getCookie(name) { const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)')); return match ? decodeURIComponent(match[1]) : ''; } document.querySelectorAll('input[name="gclid"], input[name="fbclid"]').forEach((input) => { input.value = getCookie(input.name); }); Note that Meta expects the fbclid stored as an fbc value in its documented format, so format it before sending. Set cookie lifetime and storage according to your consent setup.
When the ID never shows up
- Google Ads auto-tagging is off.
- A redirect strips query parameters.
- A consent banner blocks storage.
Click your own ad and check the URL and the hidden field.
Full guide: offline conversion tracking: closing the loop


