Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save derekcavaliero/31f5b730f42601c357bbdb93533a6cd0 to your computer and use it in GitHub Desktop.
Save derekcavaliero/31f5b730f42601c357bbdb93533a6cd0 to your computer and use it in GitHub Desktop.
Push a window.postMessage event to the parent window for iframed Pardot forms. You can then intercept this message via Google Tag Manager (see: X) for an example.
<script>
if ( window.parent.postMessage ) {
window.parent.postMessage({
'event': 'Form Submission', // Never change this
'form_id': '1234', // The Pardot form ID (you can get this from the form edit page URL)
'form_label': '[Whitepaper] - The 2020 State of Digital Accessibility', // This can really be whatever you want.. but make sure its descriptive
'form_action': 'Gated Resource Download' // See suggested Form Actions
}, '*');
}
</script>
@derekcavaliero
Copy link
Author

Suggested form actions:

Service Inquiry
If the form submitted is related to a particular service you sell.

Product Inquiry
If the form submitted is related to a particular product you sell.

Demo Request
If the form is to request a demo (either on-demand or 1:1).

Trial Request
If the form is to request a trial.

Contact Request
More generic forms that aren't specific to a particular service/product.

Gated Resource Access
E-Books/Whitepapers/Case Studies/Infographics/Reports/Guides/Video etc… Basically any downloadable resource where a form submission is required.

Webinar Registration/Replay
We split out webinars into their own action because they're a bit different than gated video you would typically place under resources.

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