# Set up SourceTag with FormAssembly

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

FormAssembly is commonly used in enterprise environments, often connected directly to Salesforce. It supports hidden fields (called prefill fields) that SourceTag can populate with attribution data when the form is embedded on your website.

## What you need

- SourceTag installed on your website
- A FormAssembly account (any plan that supports web forms)
- The form embedded on your site - not hosted on FormAssembly's domain

## Important: embed method

FormAssembly forms can be hosted on FormAssembly's own domain or embedded on your site. SourceTag needs the form to be on your site so it can access the form fields. Use the **JavaScript embed** or **HTML embed** method. Avoid the direct link (hosted) option.

## Step 1: Open your form in the FormAssembly editor

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

1. In the form builder, click **Add Field** (the field palette on the left)
2. Find the **Hidden** field type and drag it onto your form
3. Repeat for each SourceTag field you want to capture


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

For each hidden field:

1. Click on the hidden field in the form builder
2. Open the **Properties** panel (right side or below)
3. Find the **Field Alias** (or **Field Name**) setting
4. Set it to the SourceTag field name exactly (e.g. `st_fc_channel`)
5. Leave the default value empty

The field alias controls the HTML `name` attribute when the form is rendered. SourceTag uses this to find and populate the field.


## Step 4: Embed the form on your site

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

The page must also have the SourceTag script installed.

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

<!-- FormAssembly JS embed -->
<script type="text/javascript" src="https://YOUR_INSTANCE.tfaforms.net/js/YOUR_FORM_ID"></script>
```

If you are using an iframe embed, SourceTag will not be able to access the form fields due to cross-origin restrictions.


## Step 5: Test

Visit the page with UTM parameters:

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

Submit the form. In FormAssembly, go to **Responses** and check the test entry. The hidden fields should contain your attribution data.

If your form is connected to Salesforce, also check the Salesforce record to confirm the data flowed through.
## Tips

- FormAssembly field aliases are case-sensitive. Copy the field names from the Fields page in your SourceTag dashboard (each name has a copy button).
- If your FormAssembly form posts directly to Salesforce via a connector, make sure the hidden fields are mapped to the correct Salesforce fields in the connector settings.
- FormAssembly's prefill feature can conflict with SourceTag if you have set default values on hidden fields. Leave default values empty so SourceTag can populate them.
- For Salesforce-connected forms, you will typically need matching custom fields on the Lead or Contact object in Salesforce. See [Set up SourceTag with Salesforce Web-to-Lead](https://sourcetag.io/docs/fields-salesforce-web-to-lead) for guidance on the Salesforce side.
