UTM Governance
By Naomi D. Nakashima · helpmenaomi.com
Three jobs: design a convention, build links that follow it, and audit what's already in the data. Pick whichever the user needs; most people start with the audit, because that's where the pain shows.
1. Design a convention
Ask only what you need, in one message:
- Which channels they run (email, paid search, paid social, organic social, partners, events, SMS, QR/print).
- Which analytics tools read the UTMs (GA4, HubSpot, Salesforce campaigns, Marketo programs).
- Whether campaigns have IDs or names in a planning tool already.
Then write the convention from references/convention-template.md. Fill in their real values; don't leave the template's examples in. Key rules:
utm_mediumcomes from a short, fixed list that matches GA4's default channel rules (references/ga4-channels.md). That's the field that decides the channel, so it's the one that most needs locking down.utm_sourceis the platform or publication, lowercase, from an allowed list.utm_campaignfollows a pattern such asyyyy-mm_program_name, lowercase with hyphens or underscores (pick one and stick with it).utm_contenttells apart creatives or links within a campaign;utm_termis for paid keywords or audiences.- No spaces, no capitals, no personal data (never put email addresses or names in a UTM).
Offer the result as a doc they can share with their team.
2. Build links
For one or a few links, build them by hand following the convention. For a batch, put the rows in a CSV with columns url,source,medium,campaign,content,term and run:
python3 scripts/utm.py build links.csv --out tagged.csv [--allowed-mediums email,cpc,paid-social,social,referral,affiliate,display]
The script lowercases values, swaps spaces for hyphens, keeps any query strings and #anchors already on the URL, warns when a medium isn't on the allowed list or won't map to a GA4 channel, and writes tagged.csv with the finished URLs.
3. Audit existing data
Ask for an export with source and medium columns (and sessions, if they have it). In GA4 that's Reports › Acquisition › Traffic acquisition with "Session source / medium" as the dimension, or an Explore. Then run:
python3 scripts/utm.py audit export.csv --source "Session source" --medium "Session medium" [--sessions Sessions] [--campaign "Session campaign"]
It also takes one combined "source / medium" column: --source-medium "Session source / medium".
The audit reports:
- Case and spacing splits (
Emailvsemailvse-mail), with the sessions each split takes up. - Mediums GA4 can't map to a default channel (they land in Unassigned), with the closest standard medium to use instead.
- Near-duplicate sources (
linkedin,linkedin.com,lnkd.in,LinkedIn_Ads). - Personal data in values (anything that looks like an email address).
- A share of sessions affected, so the user can see whether this is worth fixing.
Write up the findings as: what's broken, what it costs in reporting, a mapping table (old value → standard value) the team can use going forward, and how to fix history. GA4 doesn't rewrite past data, so the options are custom channel groups for reporting, or cleanup in the warehouse or BI layer.
Notes
- GA4's default channel definitions change from time to time.
references/ga4-channels.mdsummarizes them; check the current Google Analytics help page ("Default channel group") before telling anyone a rule is final. - Link shorteners and redirects can drop UTMs. Test one link end to end before a big send.