1. Home
  2. Docs
  3. Lead Tracking
  4. Form Tracking
  5. Tracking Web Forms in Iframes

Tracking Web Forms in Iframes

When a form is embedded using an iframe from a different domain, the form is actually hosted somewhere else either on the same domain or with 3rd party provider on an external domain.

Same Domain

If your form is hosted within the same domain, make sure your WhatConverts tracking script is on the page that is serving the form.

3rd Party Provider (External Domain)

If your form is hosted by a 3rd party provider, security measures implemented by browsers known as same-origin policy prevent the WhatConverts tracking script from accessing the content of the iframe. The following steps need to be followed in order to track forms in the iframe:

    1Add your tracking script to the page that is serving the form with the 3rd party provider.

    2Add the following JavaScript function to the page on your site where the iframe is being initiated.

      <iframe id="iframe-website" width="100%" height="800" frameborder="0"></iframe>
      <script type="text/javascript">

This code passes along the traffic source details to the tracking script with the 3rd party provider. The URL source of the iframe should replace “https://www.whatconverts.com/” and the ID attribute should replace both instances of “iframe-website“.

Below is an example of an iframe form from Acuity Scheduling.
Iframe Source and ID for Form Tracking in Iframes

Note: The WhatConverts tracking script needs to be installed on the page before the JavaScript function above.