# Set up SourceTag with Typeform

Canonical: https://sourcetag.io/docs/fields-typeform

Typeform handles hidden fields differently from WordPress form builders. You create them in Typeform's settings, and they get populated via the embed URL or by SourceTag's script when embedded on your site.

## What you need

- SourceTag installed on your website (not on Typeform itself)
- A Typeform form embedded on your site

## Step 1: Open your Typeform

Go to your Typeform and click **Create** or open an existing form.
## Step 2: Add hidden fields

1. Click the **Logic** tab (or **Settings** depending on your Typeform version)
2. Find **Hidden Fields**
3. Click **Add hidden field**
4. Enter the field name exactly as it appears in SourceTag

### Core fields (add these)

Add each of these as a separate hidden field:

- `st_fc_channel`
- `st_fc_detail_1`
- `st_fc_detail_2`
- `st_fc_detail_3`
- `st_fc_detail_4`
- `st_lc_channel`
- `st_lc_detail_1`
- `st_lc_detail_2`
- `st_lc_detail_3`
- `st_lc_detail_4`
- `st_fc_landing_page`
- `st_lc_landing_page`

### Optional extended fields

If you've enabled extended field groups in your SourceTag dashboard, also add:

- `st_fc_click_id` and `st_lc_click_id` (click IDs)
- `st_visits` (visit count)
- `st_days_to_convert` (days to convert)
- `st_device` (device type)

See [Captured Fields](https://sourcetag.io/docs/captured-fields) for the full list of available fields.

## Step 3: Embed on your site

Embed the Typeform on your website using the **Standard** embed method (not popup or slider, which may not work reliably).

The embed code goes on a page that already has the SourceTag script installed. SourceTag detects the Typeform embed and populates the hidden fields.

```html
<!-- Your site already has SourceTag -->
<script src="https://cdn.sourcetag.io/scripts/YOUR_ID/st.js"></script>

<!-- Typeform embed -->
<div data-tf-live="YOUR_FORM_ID"></div>
<script src="//embed.typeform.com/next/embed.js"></script>
```
## Step 4: Test

Visit the page with UTM parameters:

```text
?utm_source=test&utm_medium=cpc&utm_campaign=typeform-test
```

Complete the Typeform. Check the responses in Typeform. The hidden fields should show the attribution data.
## How it works

SourceTag uses the `data-tf-hidden` attribute on the Typeform embed element to pass attribution data. The values are set as comma-separated `key=value` pairs on this attribute. Typeform reads these and maps them to the hidden fields you configured in Step 2.

## Important notes

- SourceTag must be on the PAGE where Typeform is embedded, not on Typeform's hosted URL.
- The **Standard** embed works best. Popup and slider embeds may have timing issues.
- If hidden fields aren't being populated, check that the Typeform loads AFTER SourceTag's script. SourceTag uses a MutationObserver to detect dynamically loaded forms.
- Typeform hidden fields are case-sensitive. Make sure the names match exactly.
