Capturing the gclid in a Hidden Form Field
Oct 3, 2024
There are 2 reasons why you’d want to capture Google Ad’s gclid for leads coming from Google Ads. The first reason is so you can see which leads came from Google Ads in your CRM.
Note: Some CRMs like Hubspot will automatically capture it if you use their web forms.
The 2nd reason to capture the gclid is to track Google Ad offline conversions.
This allows you to feed your Google Ad campaign with higher quality conversion signals like offline sales conversions or marketing qualified lead conversions.
So how do you capture the gclid when a Google Ad visitor submits a web form to become a lead?
First step is to make sure you have auto-tagging enabled in your Google Ads account.
Next step is to add a hidden form field to all your lead gen forms on your website or landing page. Depending on what you’re using for your web forms, this may be easy to do or impossible. Depending on what you’re using for a web form, if it’s difficult to capture gclid or impossible then it’s definitely worth considering updating your web forms because capturing gclid is important.
Next, grab this javascript code provided by Google and add it to every page of your website.
Make sure this bit of code (see below) matches the HTML ID for your hidden form field, as you can see you can add more than one HTML ID if you have multiple forms with hidden form fields that have different HTML IDs. Just make sure to put the ID in single quotes and a comma in between like shown here:
Once you have that all set up, you can proceed to test it all out like I show in this video below: