# Set up SourceTag with Formstack

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

Formstack's form builder includes a Hidden field type. You add one field per SourceTag data point and set the field label to match.

## What you need

- SourceTag installed on your website
- A Formstack account
- The form embedded on your site using the JavaScript embed (not iframe)

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

Log in to Formstack and open the form you want to track.
## Step 2: Add hidden fields

1. In the form builder, look at the **Field Types** panel on the left
2. Under **Standard** or **Advanced** fields, find **Hidden**
3. Drag or click to add a Hidden field to your form
4. Repeat for each SourceTag field


### 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 label and name

For each hidden field:

1. Click on the hidden field in the form builder
2. Set the **Field Label** to the SourceTag field name (e.g. `st_fc_channel`)
3. Check the **Field Settings** area. Formstack generates a field name from the label. Make sure the resulting `name` attribute matches the SourceTag field name exactly
4. Leave the default value empty

If Formstack modifies the name (for instance by adding a prefix or number), check the field settings for a way to set a custom name or use the label as-is.


## Step 4: Embed using JavaScript

When embedding the form on your site, use the **JavaScript embed** method. This renders the form in your page's DOM so SourceTag can reach the hidden fields.

1. In Formstack, go to **Publish** or **Share**
2. Choose the **JavaScript embed** option
3. Copy the code and paste it onto your page

Avoid the iframe embed, as cross-origin restrictions will prevent SourceTag from accessing the form.


## Step 5: Test

Visit the page with UTM parameters:

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

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

- Copy field names from the Fields page in your SourceTag dashboard to avoid typos.
- Hidden fields do not appear to visitors when the form is rendered.
- If you are using Formstack integrations (Salesforce, HubSpot, etc.), map the hidden fields to the corresponding CRM properties.
- Formstack's JS embed is the most reliable method. If you are embedding via WordPress, the Formstack WordPress plugin renders via JS by default and should work fine.
