# Custom Parameters

Canonical: https://sourcetag.io/docs/custom-parameters

SourceTag captures UTM parameters and click IDs by default. But you might have other URL parameters you want to track. Custom parameters let you capture any arbitrary URL parameter and pass it into your forms.

## How it works

1. You tell SourceTag which URL parameters to watch for
2. When a visitor lands on a page with that parameter in the URL, the value is captured and stored in the cookie alongside the rest of the attribution data
3. When the visitor submits a form, the value is populated into hidden fields named `st_fc_custom_[name]` (first click) and `st_lc_custom_[name]` (last click)

For example, if you configure `brand` as a custom parameter and a visitor arrives via:

```text
https://yoursite.com/?utm_source=google&utm_medium=cpc&brand=acme
```

SourceTag will populate hidden fields `st_fc_custom_brand` and `st_lc_custom_brand` with the value `acme` when that visitor submits a form. Custom parameters follow the same first click / last click model as the rest of your attribution data.

## Setting up custom parameters

1. In the SourceTag dashboard, go to your site's **Fields** page
2. Scroll down to the **Custom Parameters** section
3. Add the URL parameter names you want to capture
4. Save your changes

## Common use cases

### Brand or product tracking

If you run campaigns for multiple brands or products under one domain, add `brand` or `product` as a custom parameter. Tag your ad URLs accordingly:

```text
?utm_source=google&utm_medium=cpc&utm_campaign=summer-sale&brand=acme
```

This lets you attribute leads to specific brands within your CRM.

### Affiliate or partner IDs

Track which affiliate or partner referred a lead:

```text
?utm_source=partner-network&utm_medium=affiliate&affiliate_id=12345
```

Configure `affiliate_id` as a custom parameter. The hidden fields `st_fc_custom_affiliate_id` and `st_lc_custom_affiliate_id` will contain `12345`.

### Ad creative tracking

Go beyond `utm_content` with specific creative identifiers:

```text
?utm_source=facebook&utm_medium=cpc&creative=video-testimonial-v2
```

Configure `creative` as a custom parameter to capture the creative variant.

### Campaign-specific parameters

Any parameter your marketing team uses in URLs can be captured. Some examples:

| Parameter | Example value | First click field | Last click field |
|---|---|---|---|
| `brand` | acme | `st_fc_custom_brand` | `st_lc_custom_brand` |
| `affiliate_id` | 12345 | `st_fc_custom_affiliate_id` | `st_lc_custom_affiliate_id` |
| `creative` | video-testimonial-v2 | `st_fc_custom_creative` | `st_lc_custom_creative` |
| `audience` | retargeting-30d | `st_fc_custom_audience` | `st_lc_custom_audience` |
| `region` | us | `st_fc_custom_region` | `st_lc_custom_region` |
| `offer` | free-trial | `st_fc_custom_offer` | `st_lc_custom_offer` |

## How custom parameters are stored

Custom parameters are stored in the cookie as part of the first click and last click touch objects, just like UTMs and click IDs. They persist across page views and sessions.

- **First click**: The custom parameter values from the visitor's first visit are stored permanently and never overwritten.
- **Last click**: Updated on each new visit that has attribution data (UTMs, click IDs, custom parameters, or an external referrer).

## CRM field setup

When creating custom fields in your CRM to receive custom parameter data, you need fields for both first click and last click values. The internal field names must match the `st_fc_custom_[name]` and `st_lc_custom_[name]` format.

For example, if you've configured `brand` as a custom parameter:
- In HubSpot, create contact properties with internal names `st_fc_custom_brand` and `st_lc_custom_brand`
- In Salesforce, create custom lead fields with API names `st_fc_custom_brand` and `st_lc_custom_brand`
- In other CRMs, follow the same pattern

## Tips

- Parameter names are case-sensitive. `Brand` and `brand` are treated as different parameters.
- Only parameters present in the URL are captured. If a visitor arrives without the parameter, no hidden field is created for that visit.
- You can add as many custom parameters as you need. There's no hard limit.
- Make sure your marketing team knows which parameter names to use in their campaign URLs to keep things consistent.
