GA4 Lab 2: Audit Your Campaign Links for UTM Mistakes and Build a Tracking Plan
Goal
Check a list of campaign links against our naming rules, then write a tracking plan for the next campaign.
Naming Rules
utm_source,utm_mediumandutm_campaignare required- All values are lowercase, with no spaces
utm_mediummust be one of: email, cpc, paid_social, social, organic, referral
The Checker
python
from urllib.parse import urlparse, parse_qs
links = [
"https://example.com/?utm_source=newsletter&utm_medium=email&utm_campaign=nov_sale",
"https://example.com/?utm_source=Facebook&utm_medium=paid_social&utm_campaign=Nov Sale",
"https://example.com/?utm_medium=email&utm_campaign=nov_sale",
"https://example.com/?utm_source=google&utm_medium=cpc&utm_campaign=brand",
]
ALLOWED = {"email","cpc","paid_social","social","organic","referral"}
for i,u in enumerate(links,1):
q = {k:v[0] for k,v in parse_qs(urlparse(u).query).items()}
problems=[]
for req in ("utm_source","utm_medium","utm_campaign"):
if req not in q: problems.append("missing "+req)
for k,v in q.items():
if v != v.lower(): problems.append(k+" has uppercase")
if " " in v: problems.append(k+" has space")
if q.get("utm_medium") and q["utm_medium"] not in ALLOWED:
problems.append("medium not allowed")
print(i, "OK" if not problems else "; ".join(problems))
Result
1 OK | 2 utm_source has uppercase; utm_campaign has uppercase; utm_campaign has space | 3 missing utm_source | 4 OK
Your Turn
- Add a link with
utm_medium=Emailand see what the checker says - Add a rule that warns when
utm_campaignis longer than 30 characters - Fix link 2 by hand and run the checker again
Tracking Plan for a New Campaign
Copy this table and fill it for your own campaign.
| Item | Example |
|---|---|
| Goal | 200 newsletter signups in 30 days |
| Key event | sign_up (method = newsletter) |
| Channels | Email, Paid Social, Organic Social |
| UTM campaign name | winter_course_launch |
| Landing page | /winter-course/ |
| Report to watch | Traffic acquisition with key event sign_up |
| Owner and review date | Priya, every Monday |
Conclusion
A small checker catches UTM mistakes quickly. A tracking plan keeps everyone using the same names.
Quick Summary: Rules; checker; exercises; tracking plan.

