# Set up SourceTag with Shopify Forms

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

Shopify contact forms are built with Liquid templates. You add hidden inputs by editing the theme code directly.

## What you need

- SourceTag installed on your Shopify site (script in theme.liquid)
- Access to your Shopify theme editor

## Step 1: Open the theme code editor

Go to Online Store > Themes > Actions > Edit Code.
## Step 2: Find the contact form template

Look in the templates or sections folder for a file that contains the contact form. Common locations include sections/contact-form.liquid or templates/page.contact.liquid.
## Step 3: Add hidden inputs

Inside the contact form, add hidden input elements before the submit button:

Core hidden fields:

```html
<input type="hidden" name="contact[st_fc_channel]" data-st-field="st_fc_channel">
<input type="hidden" name="contact[st_fc_detail_1]" data-st-field="st_fc_detail_1">
<input type="hidden" name="contact[st_fc_detail_2]" data-st-field="st_fc_detail_2">
<input type="hidden" name="contact[st_fc_detail_3]" data-st-field="st_fc_detail_3">
<input type="hidden" name="contact[st_fc_detail_4]" data-st-field="st_fc_detail_4">
<input type="hidden" name="contact[st_lc_channel]" data-st-field="st_lc_channel">
<input type="hidden" name="contact[st_lc_detail_1]" data-st-field="st_lc_detail_1">
<input type="hidden" name="contact[st_lc_detail_2]" data-st-field="st_lc_detail_2">
<input type="hidden" name="contact[st_lc_detail_3]" data-st-field="st_lc_detail_3">
<input type="hidden" name="contact[st_lc_detail_4]" data-st-field="st_lc_detail_4">
<input type="hidden" name="contact[st_fc_landing_page]" data-st-field="st_fc_landing_page">
<input type="hidden" name="contact[st_lc_landing_page]" data-st-field="st_lc_landing_page">
```

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

Note: Shopify contact forms use the `contact[field_name]` format, which SourceTag won't match by default. The `data-st-field` attribute on each input tells SourceTag which value to populate, regardless of the `name` attribute. The data appears in notification emails under the `contact[...]` field names.
## Step 4: Save and test

Save the theme file. Visit your contact page with UTM parameters:

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

Submit the form. Check the notification email from Shopify for the attribution data.

## Tips

- Shopify contact form notifications include all submitted fields, including hidden ones.
- If you use a third-party form app (PageFly, etc.), follow that app's hidden field instructions instead.
- Make sure the SourceTag script loads in theme.liquid before the closing head tag.
