Skip to main content

Guide: How to track form submissions using Google Tag Manager when your forms are placed in iFrames

In this guide, you will learn how to use GTM to track website activities when your websites' forms are placed in iFrames.

Pauline from SalesWings avatar
Written by Pauline from SalesWings
Updated over a week ago

When your website uses an iframe to embed a form (often hosted on another domain), the parent page can’t “see” what happens inside the iframe. To track these submissions with SalesWings, you must deploy the SalesWings GTM tag in both places and bind them as Host ↔ Guest.

Prerequisites

  1. GTM access for the parent site and the iframe content (separate containers if the iframe is on a different domain). If GTM isn’t installed yet, see Google’s quickstart. Google for Developers

  2. Your SalesWings Project ID (pid).

  3. You already deployed the SalesWings tag to the parent site (base setup). If not, start here → Implement SalesWings using Google Tag Manager.

Step 1 -> Configure SalesWings in the iframe (Guest)

Create a tag in the iframe’s GTM container:

  1. Tag type: SalesWings (template)

  2. Project ID (pid): paste your pid

  3. Frame Binding:

    • Mode: Guest

    • Trusted Domain(s): enter the domain that hosts the parent page (e.g., www.example.com)

  4. Track Forms:

    • Enabled

  5. Trigger: All Pages (or the iframe page scope) → Save
    (These fields mirror the existing article; we’re naming them precisely for clarity.

Step 2 -> Update SalesWings in the parent page (Host)

In the parent site’s GTM container, open your existing SalesWings tag and set:

  • Frame Binding → Mode: HostSave

  • Keep CSS selector set to "iframe"

  • Publish your container
    (This aligns with the current template options and your existing implementation guide.)

Step 3 -> Publish both GTM containers

Submit the parent and iframe containers so the changes go live.

Examples:

(Parent) Outside iFrame:

Inside iFrame:


Have any questions or concerns? Feel free to reach out to your Customer Success Manager!

Did this answer your question?