# UTM parameters, click ids and ref links

> Which query parameters Statsy reads, the click ids it recognises, and how each visit is sorted into a channel.

Section: Tracking script  
Canonical page: https://statsy.co/docs/tracking-script/query-parameters-and-utms  
Last updated: 2026-09-15

Statsy reads a fixed set of query parameters from the landing URL. Everything else in the query string is ignored by default.

## What is read

- `utm_source`, `utm_medium`, `utm_campaign`, `utm_term` and `utm_content`. Each becomes a breakdown you can group and filter by.
- Ad click identifiers: `gclid`, `wbraid`, `gbraid`, `msclkid`, `dclid`, `gad_source` and `yclid` for search ads; `fbclid`, `ttclid`, `li_fat_id`, `twclid`, `rdt_cid`, `igshid`, `sccid` and `epik` for social ads. The first one present is kept.
- `ref` or `via`, the usual parameters of referral and affiliate programs.

Parameter names are matched case-insensitively, values are trimmed to 200 characters, and a hash-routed URL such as `/#/pricing?utm_source=x` is read too.

## How a visit becomes a channel

Each visit lands in exactly one channel. The first rule that matches wins:

1. An ad click id: search ids mean paid search, social ids mean paid social.
2. `utm_medium`: `cpc`, `ppc`, `sem` and friends mean paid search, unless the source is a social network, in which case paid social; `display`, `banner`, `cpm` and `native` mean display; `email` and `newsletter` mean email; `affiliate` and `partner` mean affiliate; `social` means social; `organic` and `seo` mean organic search.
3. A `ref` or `via` parameter means affiliate.
4. The referrer host: known mail hosts mean email, AI assistants mean AI, search engines mean organic search, social networks mean social, anything else means referral.
5. With no referrer at all, `utm_source` alone is used as a hint.
6. Nothing matched: direct.

## Tag links you control

Ads carry click ids by themselves. What needs your own tags is everything else: newsletters, partner placements, sponsorships and community posts. `utm_source` plus `utm_medium` is enough for the channel to be right, and `utm_campaign` groups a launch together.

```text
https://yourstartup.com/?utm_source=newsletter&utm_medium=email&utm_campaign=launch
```

## Query strings in page paths

Page paths drop their query string by default, so `/pricing?ref=abc` is recorded as `/pricing`. That keeps one page from splitting into hundreds of rows and keeps tokens out of your reports. UTM tags and click ids are still read and still attributed. If you genuinely need the query string in the path, turn it on under **Site settings › Tracking** and read the warning there first.

Previous: [Subdomains and multiple domains](https://statsy.co/docs/tracking-script/subdomains-and-cross-domain)  
Next: [Content Security Policy](https://statsy.co/docs/tracking-script/csp)