Browse Help Center
Browse Help Center
Join 20,000+ other marketers and start getting marketing clarity

Subscribe to our newsletter and get proven marketing strategies for growing your business.

    Related Integrations
    Calendars and Bookings Calendly

    Last update on July 21, 2022

    Calendly
    Marketing Automation Pabbly Connect

    Last update on July 22, 2022

    Pabbly Connect
    Chat Livechat

    Last update on September 1, 2022

    Livechat
    Help Center Lead Tracking Form Tracking

    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 the following to the page where your form is hosted. This will be the third party provider such as Formsite, Pardot, etc.

    This script identifies the Parent URL where you have put your form. Replace https://YourURL.com/ with your site's URL.

    <script type="text/javascript">
    wc_frame_parent = 'https://YourURL.com/';
    </script>

    Below this script, paste your WhatConverts tracking script

    2Add one of the following JavaScript functions to the page on your site where the iframe is being initiated using the ID, Name, Class or Role of the Iframe above or before your WhatConverts tracking code on your site.

      Note: If you haven't added your WhatConverts tracking script to your website, add your tracking script. If you are using the WhatConverts WordPress Plugin, you will want to deactivate the plugin and place your WhatConverts Tracking Code below one of the following codes.

    Iframe Name: Replace iframe_test with the Name attribute.
    <script type="text/javascript">
    wc_frame_target = '[name=iframe_test]';
    </script>

    Iframe ID: Replace iframe_test with the ID attribute.
    <script type="text/javascript">
    wc_frame_target = '#iframe_test';
    </script>

    Iframe Class: Replace iframe_test with the class attribute.
    <script type="text/javascript">
    wc_frame_target = '.iframe_test';
    </script>

    Iframe Role: Replace iframe_test with the role attribute.
    <script type="text/javascript">
    wc_frame_target = '[role=iframe_test]';
    </script>

    Below is an example of how to find an iframe ID attribute.

    iframe gif

    The ID of the iframe above is frame-one458908311.

    Was this page helpful?
    👍Yes
    👎No
    Get a FREE presentation of WhatConverts

    One of our marketing experts will give you a full presentation of how WhatConverts can help you grow your business.

    Schedule a Demo
    Whatconverts Features for your Business
    Track Leads with First Party Data
    Lead Tracking Track Leads with First Party Data

    WhatConverts tracks your leads using first party data, so you don't have to worry about recent bans to third-party cookies.

    Report Builder
    Analytics & Insights Report Builder

    Create, save and send unique reports that suit the needs of your business.

    Port Your Numbers
    Lead Tracking Port Your Numbers

    Don't worry about losing your phone numbers; Port current phone numbers at no charge.

    Leads by Landing Page
    Analytics & Insights Leads by Landing Page

    See how leads got to your site and the page they were on when they reached out.

    Join 20,000+ other marketers and start getting marketing clarity

    Subscribe to our newsletter and get proven marketing strategies for growing your business.

      Related Integrations
      Ad Platforms Facebook Ads

      Last update on July 21, 2022

      Facebook Ads
      Landing Pages & Site Builders Landingi

      Last update on July 22, 2022

      Landingi
      Chat Crisp

      Last update on July 22, 2022

      Crisp
      ready to get marketing clarity?

      Grow your business with WhatConverts

      14 days free trial Easy setup Dedicated support
      G2 Users Love Us Badge
      G2 High Performer Badge
      G2 High Performer Small Business Badge
      G2 Momentum Leader Badge
      G2 High Performer Europe Badge