1. Help Center
  2. Lead Tracking
  3. Form Tracking
  4. 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, add the tracking script to 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 the iframe:

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

    2 Add this 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">
      wc_iframe_ypbib('https://www.whatconverts.com/','iframe-website');
      </script>

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“.

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