If you’re using the automated solution for Google Ads Click ID:
• the GCLID is automatically captured and associated with the property hs_google_click_id.
If you’re using a dev, forms, and JavaScript, for example:
• Ensure your URLs from Google Ads include the GCLID parameter.
• Create a Hidden Field in your HubSpot Form
• Use JavaScript to capture the GCLID from the URL and set it in the hidden form field
The same technique will work for using JS to grab the LinkedIn Click ID and store it to your custom property on an additional hidden field.
One thing that may help is to have your developer, if you’re going that route, try to get a basic implementation set up and then post here with more details if they get stuck.
GCLID is great, but we need to track click IDs from multiple sources (Meta, MS Ads, TikTok, and on and on) and would prefer a generic solution. As it stands, we have not been able to get the values into hidden fields in the tag manager - something I’ve done many times with many forms solutions… we think due to how Hubspot loads the forms onto our clients’ sites… and I’m sort of blown away that no tutorial seems to exist. Are people not doing offline conversions?
Any links for this?
@Jaycee_Lewis - For the JS embedding. I have a few form that I am embedding. Unfortunately they are all in iFrames. would this be the right code for the JS embed? Not going to lie i got this from ChatGPT.
Hi there @NShah6
Thanks for reaching out to the Community—I’m glad you brought this question forward!
I’m looping in a few folks who have deeper experience with this setup and may be able to add some helpful context. Hi @sylvain_tirreau, @Anton and @SteveHTM do you have any tips to share with Nandan please?
If anyone has guidance to share, your expertise would be truly appreciated.
Hi @NShah6 — thanks for sharing the snippet. I’ve been going through your query and the code itself isn’t the issue here. The main blocker is that your HubSpot forms are embedded inside iframes, which prevents HubSpot (and your JS) from reliably reading the page URL and capturing GCLID or other click IDs. That’s a known limitation, especially on platforms like Wix.
If possible, the most reliable fix is to use the native HubSpot embed (hbspt.forms.create) without an iframe wrapper. If you’re forced to use iframes, capturing click IDs requires passing them into the iframe and running the logic inside it, which does need dev work.
For GCLID capture in HubSpot forms, you have a few options:
Option 1: Use HubSpot’s built-in UTM fields
HubSpot has default fields for UTM parameters, but they only capture the GCLID if the user completes the form on the exact same page they initially land on. If they browse around your site before converting, the GCLID gets lost.
Option 2: Custom JavaScript
You could have a developer write code to capture the GCLID when someone lands, store it in localStorage, and then populate hidden fields on your forms. This requires ongoing maintenance as browsers update though.
Option 3: Use a dedicated tool
Tools like Attributer.io can handle this automatically. They capture the GCLID (plus FBCLID for Facebook, MSCLKID for Microsoft, etc.) when someone first arrives, store it in a cookie, and then write it into hidden fields on your HubSpot forms when they’re submitted. This means the GCLID gets captured even if someone converts days later or after visiting multiple pages.
Regarding the automated Google Ads solution you mentioned, that’s for sending conversions back to Google Ads, not for capturing the GCLID from form submissions. Those are two different things. The automated solution helps with conversion tracking, but you’d still need to capture the GCLID data with each lead if you want it in your HubSpot contact records.
For LinkedIn Click ID, there isn’t a native HubSpot solution, so you’d need either custom code or use a tool like Attributer to do it.
Hope this helps clarify things!
Disclosure: AI helped me structure this response because I’m not the best writer, but I’ve reviewed and refined it based on my experience before posting.