# Set up SourceTag with JotForm

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

JotForm supports hidden fields that SourceTag can populate with attribution data. There is one critical requirement: you must embed the form using the **JavaScript embed** method, not an iframe.

## Before you start: embed method matters

JotForm offers several embed options. Only the **JavaScript (source code) embed** works with SourceTag. The iframe embed loads the form on JotForm's domain, which means SourceTag cannot access the form fields due to cross-origin restrictions.

If you are currently using the iframe embed, you will need to switch to the JS embed.

## What you need

- SourceTag installed on your website
- A JotForm account
- The form embedded on your site using the **JavaScript embed** method

## Step 1: Open your form in the JotForm builder

Log in to JotForm and open your form in the form builder.
## Step 2: Add hidden fields

1. Click **Add Form Element** (the "+" button on the left panel)
2. Go to the **Form Elements** section (or search for "hidden")
3. Find **Hidden Field** and click it to add to your form
4. Repeat for each SourceTag field

In some JotForm versions, hidden fields are under the **Widgets** section. Either location works.


### Core fields (add these)

Add a hidden field for each of the following:

- `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 have 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 since first visit)
- `st_device` (device type)

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

## Step 3: Set the field name

For each hidden field:

1. Click on the hidden field
2. In the field properties panel (right side), find the **Field Name** or **Unique Name** setting
3. Set it to the SourceTag field name exactly (e.g. `st_fc_channel`)
4. Leave the default value empty


## Step 4: Embed using JavaScript (not iframe)

When you publish or embed the form:

1. Click **Publish** in the JotForm builder
2. Choose **Embed**
3. Select the **Source Code** or **JavaScript** embed option
4. Copy the embed code and paste it onto your page

The embed code should look something like this (a `<script>` tag), not an `<iframe>`:

```html
<!-- Correct: JS embed -->
<script type="text/javascript" src="https://form.jotform.com/jsform/YOUR_FORM_ID"></script>

<!-- Wrong: iframe embed - SourceTag cannot access this -->
<iframe src="https://form.jotform.com/YOUR_FORM_ID" ...></iframe>
```


## Step 5: Test

Visit the page with UTM parameters:

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

Submit the form. In JotForm, go to **Submissions** and check the test entry. The hidden fields should contain your attribution data.
## Tips

- The JavaScript embed is the only method that works. If you see an iframe in your page source, switch to the JS embed.
- You can copy field names from the Fields page in your SourceTag dashboard (each name has a copy button).
- If hidden fields are not populating, inspect the rendered form HTML in your browser dev tools. The hidden input `name` attribute must match the SourceTag field name.
- JotForm's conditional logic and integrations (Google Sheets, CRM connections, etc.) all include hidden field values.
