How-to · Updated October 11, 2026
Save the Google click ID with every form lead
Updated October 11, 2026
1 hour, with a developer
Add hidden fields named gclid, gbraid and wbraid to every form, and a script on every page that stores the ID from the ad's landing address and fills those fields. Keep the latest ad click, let redirects pass the ID through, and test with a made-up ID. Google's sample script saves the gclid only.
Before you start
- Auto-tagging on in Google Ads. Without it no click ID is added to the address. It is under Admin, Account settings, Auto-tagging.
- Access to edit every form on the site, and a place in your lead system for three extra fields on each lead.
- Publish access to Tag Manager, or a developer who can add a script to every page.
Add the hidden fields
Three hidden fields on every form give each lead a place to carry its click ID.
- Add three hidden fields to every form on the site: gclid, gbraid and wbraid. Google's guide shows the gclid field; its lead upload guidance asks for GBRAID and WBRAID whenever they are available. Some iPhone and iPad clicks arrive with one of those in place of a GCLID.
- Give each hidden field an id as well as a name, and list those ids in the script. Google's sample only fills the field ids written in its gclidFormFields line, so a field it does not list stays empty on every lead.
- Make sure the form system saves those fields with each lead and passes them on to wherever leads end up, such as a CRM or the notification email. Google says the GCLID is case sensitive, so store it exactly as it arrived.
- If your form tool already records the page address with each entry, keep everything after the ? in it. When the form is on the page the ad landed on, that address carries the click ID even if a hidden field fails.
Store the ID when the visitor lands
A script on every page keeps the click ID from the ad's landing address and fills the hidden fields, since the ID is only in the address of the first page and the form may be sent pages or days later.
- Add the script to every page of the site, not only the landing pages, as Google recommends. Google's sample keeps the GCLID in browser storage for 90 days and fills the hidden field when each page loads.
- Have the script fill every matching field on the page. Google's sample fills one field per page, so on a page with two forms, such as one in the header and one in the footer, only one of them gets the ID.
- Extend it to read gbraid and wbraid the same way, each into its own field. Never fold a gbraid or wbraid into the gclid field. Each is its own identifier, with its own place in a lead upload.
- Let a newer ad click replace the stored one. A script that keeps only the first visit sends no click ID for someone who first found the site another way and came back through an ad.
- If a form appears after the page has loaded, such as in a pop-up or a second step, have the script fill it when it appears. Google's sample fills fields once, on page load.
- In Tag Manager, add the script as a Custom HTML tag on the All Pages trigger, then click Submit and Publish.
Keep the ID through redirects
A quick test with a made-up ID shows whether the click ID survives every redirect to the final landing page.
- Open your landing page with ?gclid=test added to the end of its address (use & instead of ? if the address already has a ?). If the site redirects, the address you end on must still show gclid=test. Google says the GCLID has to reach the final landing page.
- If the page shows an error instead, the site rejects unknown parameters. Google's instruction is to turn auto-tagging off, have your developer allow arbitrary URL parameters, then turn it back on.
Check it worked
Open a landing page with ?gclid=test-123 at the end of the address (use & instead of ? if the address already has a ?), click through to another page, and send a form. The lead should arrive with test-123 in its gclid field. Repeat with ?wbraid=test-456 and check the wbraid field, then delete both test leads.
After a week of ads, look at the form leads from that week. Most leads you know came from ad clicks should carry an ID. An empty field is not proof a lead came from elsewhere: private browsing in some browsers can remove tracking parameters from the address, and a cookie banner can stop the script storing one for visitors who decline.
What the saved ID is for
A lead that carries its click ID can be sent back to Google Ads when it becomes a qualified lead or a sale, so bidding learns which clicks produced customers. Google calls the GCLID strongly recommended in those uploads even when enhanced conversions is on.
Why some iPhone clicks carry no GCLID
Since Apple's App Tracking Transparency rules took effect in April 2021, Google no longer sends the GCLID on iOS traffic from a handful of Google apps. Google added the wbraid parameter to measure those clicks. Google says most advertisers need no website change for it, but a form that saves only the gclid has no click ID to keep for those leads.