I start to despair :(", "answerCount": 4, "upvoteCount": 1, "datePublished": "2020-03-16T15:06:32.000Z", "author": { "@type": "Person", "name": "Clémentine Schmiedt", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000E7aEdQAJ", "affiliation": { "@type": "Organization", "name": "Visiativ" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Your JavaScript approach should work in theory, but it only captures the GCLID if it's still present in the URL when someone loads the page with the form. If a user clicks your Google Ad, lands on your homepage (with the GCLID), then navigates to a product page or contact page before seeing the form, the GCLID will drop out of the URL and won't be captured.    The solution is to capture the GCLID when the visitor first arrives on your site, store it in a first-party cookie, and then write it into the hidden field when the form loads. You have two options:    1. You could modify your custom JavaScript to grab the GCLID when the visitor first lands on your site, store it, and then write it into the hidden fields when the form is loaded. You would need to add the code to all pages of your site, and you would need to test and maintain it.    2. You could use tools like Attributer to handle this automatically for you. It captures the GCLID (plus other attribution data like UTM parameters, referrer information, and organic channel data) when someone first lands, stores it, and then writes it into hidden fields on your Pardot forms. This means the GCLID gets captured even if the user browses multiple pages before converting (or even if they leave and come back another day).    Hope this helps    Aaron", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8tbtSAB", "datePublished": "2026-03-02T07:28:34.000Z", "author": { "@type": "Person", "name": "Aaron Beashel", "url": "https://trailblazers.salesforce.com/profileView?u=005KX0000046buSYAQ", "affiliation": { "@type": "Organization", "name": "--" } } } ] } }
Skip to main content
Hello community,

 

I can't get the GCLID parameters in an iframe Pardot form. So, When i try this method : Passing Hidden Fields with a Form iFramed on Your Website , it's ok the value is captured in my hidden field.

 

BUT I don't want to hardcode a parameter in my iframe source, Indeed, the value that's passed to the iframed form is dynamic, it's the google click id generated automatically by Google Adwords for each click on ad. S

 

o, I tested this method : Passing URL parameters from browser to iframe ( https://help.salesforce.com/articleView?id=000317377&type=1&mode=1 ) but it doesn't work ! The gclid value isn't captured in my hidden field...

 

My code : <noscript> <iframe src="https://go.pardot.com/l/185642/2017-05-16/bt1x4" width="100%" height="500" type="text/html" frameborder="0" allowTransparency="true" style="border: 0"></iframe> </noscript><script type="text/javascript"> var form = 'https://go.pardot.com/l/185642/2017-05-16/bt1x4'; var params = window.location.search; var thisScript = document.scripts[document.scripts.length - 1]; var iframe = document.createElement('iframe'); iframe.setAttribute('src', form + params); iframe.setAttribute('width', '100%'); iframe.setAttribute('height', 500); iframe.setAttribute('type', 'text/html'); iframe.setAttribute('frameborder', 0); iframe.setAttribute('allowTransparency', 'true'); iframe.style.border = '0'; thisScript.parentElement.replaceChild(iframe, thisScript); </script>

 

I start to despair :(
4 Antworten
  1. 2. März, 07:28

    Your JavaScript approach should work in theory, but it only captures the GCLID if it's still present in the URL when someone loads the page with the form. If a user clicks your Google Ad, lands on your homepage (with the GCLID), then navigates to a product page or contact page before seeing the form, the GCLID will drop out of the URL and won't be captured. 

     

    The solution is to capture the GCLID when the visitor first arrives on your site, store it in a first-party cookie, and then write it into the hidden field when the form loads. You have two options: 

     

    1. You could modify your custom JavaScript to grab the GCLID when the visitor first lands on your site, store it, and then write it into the hidden fields when the form is loaded. You would need to add the code to all pages of your site, and you would need to test and maintain it. 

     

    2. You could use tools like Attributer to handle this automatically for you. It captures the GCLID (plus other attribution data like UTM parameters, referrer information, and organic channel data) when someone first lands, stores it, and then writes it into hidden fields on your Pardot forms. This means the GCLID gets captured even if the user browses multiple pages before converting (or even if they leave and come back another day). 

     

    Hope this helps 

     

    Aaron

0/9000