Skip to content

Instantly share code, notes, and snippets.

@ericdodds
Last active August 4, 2020 20:33
Show Gist options
  • Save ericdodds/43e546f1b9e04cb6465307c7093fc8c7 to your computer and use it in GitHub Desktop.
Save ericdodds/43e546f1b9e04cb6465307c7093fc8c7 to your computer and use it in GitHub Desktop.
Pass URL parameters to Pardot form iframe
<noscript>
<iframe src="PARDOT_FORM_URL" width="100%" height="500" type="text/html" frameborder="0" allowTransparency="true" style="border: 0"></iframe>
</noscript>
<script type="text/javascript">
var form = 'PARDOT_FORM_URL';
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>
// Original Salesforce Pardot Knowledge Article here: https://help.salesforce.com/articleView?id=000269753&type=1
@adonnan
Copy link

adonnan commented Aug 4, 2020

Bless you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment