Form submissions in an iframe

The one question everyone has been wanting to figure out is how to track form submissions in an iFrame on your site. This is something that I have run into in a few instances across different agencies. The question that always remains, how do you do it?

The Problem

When submitting a form in an iframe, submitting the form doesn’t trigger anything on the parent page. This makes it hard to track form submissions in Google Analytics and tie it to the original source of the lead. For instance, if a user comes in through AdWords, it will show in Google Analytics as an AdWords user, and you can view the flow they took through the site. If they submit a form that is embedded via an iframe, nothing will show in Google Analytics as a Form Submission event. This is a problem that plagues quite a few websites that use form processors, like Google Forms, TypeForm, and more.

The Solution

Websockets, and cookies.

Websockets are lightweight connections that allow for real time transmitting of data. They allow us to embed a few small scripts on the main site, and the form submission event. When the form submits, it fires an event that is registered on the parent site via the websocket, from there you just need to do what you need to do to fire the Form Submission event on the parent site!

To help others that are having this issue, I have launched AdTrexa (currently in early alpha), a marketing platform that helps in reporting, and tracking. There will be a free tier available, so you can give it a shot and see what happens!

Leave a Comment

Your email address will not be published. Required fields are marked *