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

# Typeform form tracking

> Set up Typeform form tracking in Cometly for embedded and non-embedded forms, so each submission is tied to the ad that produced it.

Typeform form tracking connects the people who fill out your Typeform forms to the visits the Cometly pixel (the tracking script you install on your site) has already recorded. It works for forms embedded on your page and for forms that open on a Typeform URL.

This matters because the form is where a visitor becomes a lead. Once a response can be matched to the visitor who sent it, you can see which ad or channel produced each Typeform lead.

There are two ways to set up Typeform, depending on how your form is published:

1. [Embedded Typeform forms](#embedded-typeform-forms)
2. [Non-embedded Typeform forms](#non-embedded-typeform-forms), where your site visitors click a button that takes them to a Typeform URL

## Before you start

* The Cometly pixel is installed on your site: on the page your typeform redirects to (embedded forms), or on the page that holds the button (non-embedded forms). See [Install the Cometly pixel](https://docs.cometly.com/getting-started/install-pixel.md).

## Embedded Typeform forms

To track a Typeform form that is embedded on your web page, your typeform must redirect to a web page that has the Cometly pixel installed in the `<head>`, and pass the customer's information in the redirect URL as parameters.

The Cometly pixel captures the customer information that is passed in the URL. On your redirect URL, include any of these fields:

* `email`
* `first_name`
* `last_name`
* `phone`

[Video: setting up embedded Typeform forms](https://www.loom.com/embed/f669c220c62c4c0d9be8532f292ad88d)

## Non-embedded Typeform forms

### Step 1: Create a hidden field in your typeform

1. In Typeform, click **Logic**.
2. Add `fp` as a hidden field.
3. Click **Save**.

[Video: adding the fp hidden field in Typeform](https://www.loom.com/embed/9b0f4813acd947e48c75cf4362dbc461)

### Step 2: Set up your button and find its element ID

> [!WARNING]
>
> Make sure your button's URL is **empty**. The code in step 3 sends the visitor to your Typeform URL, so the button itself should not be linked.

Watch the video below to find your **button element ID**:

[Video: using the browser inspector to find the button ID](https://www.loom.com/embed/b9c45b7a56aa4e6eb520855c926108b5)

If your button does not have an element ID, assign one. The video below shows how, using Webflow as an example:

[Video: adding an element ID to a button in Webflow](https://www.loom.com/embed/d4e9c2b229694004a968fd293eda60aa)

### Step 3: Add the Cometly Typeform event listener to your web page

Add the code below before the closing `</body>` tag on the web page that holds the button.

Make these changes to the code:

* Change `live-demo-button` to your button element ID from step 2.
* Change the Typeform URL `https://5qpqychou5s.typeform.com/to/D9uuqaS0` to your own Typeform URL.
* Make sure your URL does **not** end in `#fp=XXXX`. Typeform shows that on your form's URL because you added a hidden field, but the code adds it for you.

```html theme={null}
<script>
document.addEventListener("DOMContentLoaded", function() {
  document.getElementById('live-demo-button').addEventListener('click', async function() {
    try {
      let fingerprint = await cometFingerprint();

      let typeformBaseURL = 'https://5qpqychou5s.typeform.com/to/D9uuqaS0';

      let typeformURL = typeformBaseURL + '#fp=' + encodeURIComponent(fingerprint);

      window.location.href = typeformURL;
    } catch (error) {
      console.error("An error occurred:", error);
    }
  });
});
</script>
```

[Video: adding the Typeform event listener](https://www.loom.com/embed/60685497d2804a5db1a05c13835d4c90)

### Step 4: Publish your changes and test your web page

Publish your page, then click the button. In the example in the video below, the URL after clicking the button is:

```text theme={null}
https://5qpqychou5s.typeform.com/to/D9uuqaS0?typeform-source=www.cometly.com#fp=7d52b3cd4dc9fe8af1e7c474e345d384
```

Your URL should have a series of numbers and letters after `fp=`. That is the fingerprint. Typeform records it in the response when the form is completed, and you use it in step 5.

[Video: testing your button URL for Typeform](https://www.loom.com/embed/831cc28408344a6499285f371dd3a47a)

### Step 5: Send event data with a Cometly webhook or Zapier

You can send event data from Typeform to Cometly with a Cometly webhook or with Zapier. The Typeform integration guide covers both:

[Set up the Typeform integration](https://docs.cometly.com/integrations/platforms/typeform.md)

## Check it worked

For a non-embedded form, click your button: the Typeform URL that opens ends in `#fp=` followed by a series of numbers and letters. For an embedded form, submit a test response: you land on your redirect page, and its URL contains the fields you passed, such as `email`.

Once step 5 is set up, submit a test response and open the **Events Log** tab in the **Events Manager**. The event shows there within 60 seconds.

## Frequently asked questions

### Do I need the fp hidden field for an embedded Typeform form?

No. The `fp` hidden field is only for non-embedded forms, where a button sends the visitor to a Typeform URL. An embedded form is tracked through its redirect: the Cometly pixel on the redirect page reads the customer information passed in the URL.

### Does Typeform form tracking send my submissions to Cometly as events?

Not on its own. The setup on this page lets Cometly match a response to the visitor who sent it. To record each submission as an event (an action Cometly tracks, such as a lead), [set up the Typeform integration](https://docs.cometly.com/integrations/platforms/typeform.md) with a Cometly webhook or Zapier.

### Why do my Typeform leads show in Cometly without an ad source?

Cometly can only link a submission to an ad when it can match the response to a visitor the Cometly pixel has seen. For a non-embedded form, check that the button URL contains `fp=` and that the fingerprint is mapped when you send the event. For other causes, see [Understanding No Source in reports](https://docs.cometly.com/support/troubleshooting/sources/no-source.md).

## Next steps

* [Send Typeform submissions to Cometly as events](https://docs.cometly.com/integrations/platforms/typeform.md)
* [Test form tracking on your page](https://docs.cometly.com/guides/form-tracking/testing.md)
* [Use the Events Log to confirm events arrive](https://docs.cometly.com/support/troubleshooting/general/event-log.md)
* [Set up form tracking for other third-party forms](https://docs.cometly.com/guides/form-tracking/third-party-forms.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.