> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cometly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track forms inside iframes (advanced)

> Fix iframe form tracking in Cometly: install the pixel inside the embedded form so its fields are captured, then confirm it in your browser.

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](https://docs.cometly.com/guides/tracking/pixel-helper.md) to validate form capture on your web page. You can also [test form tracking](https://docs.cometly.com/guides/form-tracking/testing.md) 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](https://docs.cometly.com/guides/form-tracking/third-party-forms.md) 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:

[How to validate form capture with Cometly in the browser](https://www.loom.com/embed/f5b1478f0cde4218befa2884060b28dc)

## 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

* [Validate form capture with your browser's inspect tool](https://docs.cometly.com/support/troubleshooting/pixel/validate-form-capture-in-browser.md)
* [Test form tracking inside Cometly](https://docs.cometly.com/guides/form-tracking/testing.md)
* [Set up form tracking for third-party embedded forms](https://docs.cometly.com/guides/form-tracking/third-party-forms.md)
* [Troubleshoot form tracking when a form or field is not detected](https://docs.cometly.com/support/troubleshooting/form-tracking/troubleshooting-form-tracking.md)
* [Check your pixel with the Cometly Pixel Helper](https://docs.cometly.com/guides/tracking/pixel-helper.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.