Skip to main content
Your form is embedded on your page in an iframe (a frame that shows content from another source), and Cometly does not capture what visitors type into it. Leads from that form arrive without a name, email or phone, or the form is not detected at all. The cause is where the Cometly pixel (the tracking script you install on your site) is installed. The pixel on your own page does not reach inside the iframe. To get iframe form tracking working, add the pixel to the iframe’s own code, then confirm it in your browser.

Start here

We recommend the Cometly Pixel Helper to validate form capture on your web page. You can also test form tracking from the Setup page in Cometly. This article is an advanced alternative: it shows how to use your browser’s inspect tool to check that the Cometly pixel works for iframes on your web page.

Use the Cometly pixel with iframe forms

An iframe lets you embed content from another source on your website, including forms from various services. To track what happens inside such an iframe, the Cometly pixel has to be installed directly in the iframe’s code.

Add the Cometly pixel to an iframe form

  1. Copy your pixel code. You find your pixel code in Cometly under Setup, step 2 Install the Cometly pixel, in the part Install the pixel (click Copy Code).
  2. Check for custom code options. Many services that offer iframe forms also let you add custom code to these forms. Locate the section of the service where you can insert code.
  3. Place the pixel code. Paste the code into the form’s custom code:
    • If you can choose between the <head> and the <body>, choose the <head>. This makes sure the pixel loads as early as possible.
    • If there is no specific <head> or <body> option, add it to the area the service provides for custom code in the iframe.
When custom code isn’t an option If the service you use doesn’t let you add custom code, you can’t automatically capture data from the iframe form. In that case, switch to a form service that gives you the flexibility you need. See Form tracking for third-party embedded forms for the services Cometly supports.

Validate your iframe form tracking

Once you have added the Cometly pixel to your iframe form, validate that it captures data correctly. The steps are the same as for a standard form:
  1. Use the browser’s inspect tool to open developer tools.
  2. Go to the Network tab.
  3. Filter the activity by typing “comet” in the search bar.
  4. Reload the iframe page to see the Cometly pixel load.
  5. Enter test data in the form fields and watch the events in the Network tab.
You should see the Cometly events that correspond to the form fields, such as first_name_changed, last_name_changed, email_address_changed and phone_changed. If these appear, the pixel is working with your iframe form and the problem is resolved. This video shows how to check that you see these events while using Inspect on the page:

Frequently asked questions

Do I still need the Cometly pixel on the page around the iframe?

Yes. The pixel inside the iframe captures the form fields, and the pixel on your own pages records where each visitor comes from. Cometly only has a record of visits to pages that carry the pixel.

Which form fields does Cometly capture from an iframe form?

The same ones as for any other form: first name, last name, full name, email and phone. Email is the most important one, because Cometly uses it to connect a form submission to the right person.

Do I need to submit the form to check that iframe tracking works?

No. The pixel sends an event as you type into each field, so entering test data is enough to see the events in the Network tab.

Next steps

Still have questions or need a hand? We’re happy to help. Reach our team at support@cometly.com.