Tracking Pardot iFrame Forms

If there is one thing that can make everyone working with homepages hate their lifes, it is iFrames. Recently i have worked a lot with Pardot Forms, which embeds into an iFrame (In most cases anyways). To track it, i looked at Ryan Praski ‘s amazing guide to tracking Pardot iFrame Forms, however. It wasn’t dynamic enough for us to use at IMPACT EXTEND. I was fortunately enough to sit with the CEO of the company Thomas Rhode, who also knows his share of JavaScript. Together we created a two part solution:

  1. One script to be imbedded in the iFrame
  2. Another script who listens for the iFrame form to be submitted

Script one – Embedded in the form

On the thank you code function in the Pardot iFrame Forms, use the following script:

Script two – Custom HTML on all pages

Add this to Google Tag Manager:

All you have to do now

If you have submitted the custom HTML tag to all pages, and added the code to your form (And remembered to change the namings and domains in the first script to your own things), then every time a form is submitted, you will be able to see the variables in the DataLayer. With this, you can now tracking it in Google Analytics, send it as a FaceBook conversion or anything else that you like.

That’s it for now. Let me know what you think =)

 

Join the discussion 2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.