Sub topic 7
Tag links and set up tracking
This chapter assumes you know basic marketing vocabulary (clicks, conversions, CTR) and have access to a web analytics tool such as Google Analytics. It covers how to tag every campaign link so you can compare search, social, and email in one report.
Why tagging matters in a fixed window
A seasonal campaign is short. If your data is split into messy groups, you find out too late to fix anything. Analytics tools read the source of a visit from the link or the referrer. Without tags, email clicks can show up as "direct" traffic, and paid social clicks can be mixed with organic social clicks.
UTM parameters solve this. They are short labels added to the end of a URL. The analytics tool reads them and files each visit under the right source, medium, and campaign.
The parameters
| Parameter | Answers the question | Example |
|---|---|---|
| `utm_source` | Where did the visitor come from? | `google`, `meta`, `newsletter` |
| `utm_medium` | What kind of channel was it? | `cpc`, `paid_social`, `email` |
| `utm_campaign` | Which campaign is this? | `winter_sale_2026` |
| `utm_content` | Which ad or link was clicked? | `headline_a`, `hero_button` |
The first three are the minimum for every link. Use utm_content when you want to compare creatives or button positions.
Agree on a naming convention first
Most tagging errors come from inconsistent names, not from the tagging itself. Email, email, and e-mail appear as three separate rows in a report. Write down the allowed values before anyone builds a link, and use lowercase with underscores.
utm_source = google | meta | newsletter
utm_medium = cpc | paid_social | email
utm_campaign = winter_sale_2026
utm_content = headline_a | video_15s | hero_buttonThe same utm_campaign value goes on every channel. That one shared value is what lets you add up results across search, social, and email.
Build links with a helper
Typing links by hand invites typos. A small function keeps the format identical every time. It also URL-encodes values, so a stray space or ampersand will not break the link.
from urllib.parse import urlencode
def utm_url(base, source, medium, campaign, content=None):
params = {
"utm_source": source,
"utm_medium": medium,
"utm_campaign": campaign,
}
if content:
params["utm_content"] = content
return f"{base}?{urlencode(params)}"
print(utm_url("https://example.com/winter-sale", "newsletter", "email", "winter_sale_2026", "hero_button"))
# https://example.com/winter-sale?utm_source=newsletter&utm_medium=email&utm_campaign=winter_sale_2026&utm_content=hero_buttonThe helper assumes the base URL has no query string yet. If your landing page already has one, join with & instead of ?.
Where tags go, and where they do not
- Social and email links: add UTM tags to every link by hand or with the helper.
- Paid search: Google Ads can append tags automatically through auto-tagging (the
gclidparameter). If you also add manual UTMs, check your analytics settings so the two do not overwrite each other. Many teams use a tracking template at the account level instead. - Internal links: never add UTM tags to links between pages of your own site. A new tag starts a new session and replaces the true source of the visit.
Set up conversion tracking
Tagged links tell you who arrived. Conversion tracking tells you what they did. Before launch:
- Mark the key action as a conversion event in your analytics tool, such as a purchase or a sign-up.
- Match each event to a KPI from your goals chapter.
- Confirm the tag fires on the thank-you page or the checkout step.
Test before you spend
Click each link yourself. Open the real-time report in your analytics tool and check that the source, medium, and campaign match your convention. Then complete a test conversion and confirm it appears. A broken tag found before launch costs minutes. Found during the peak weekend, it costs data you cannot recover.
Exercise
Your newsletter links use utm_medium=Email, and your automation tool sends some links with utm_medium=email. What goes wrong in the report, and how do you prevent it?
Show answer
Analytics treats the two values as different mediums, so email results are split across two rows and the totals look smaller than they are. Prevent it by writing the allowed values down before building links, using lowercase with underscores, and generating every link with a shared helper or template.
Exercise
Why should you avoid putting UTM tags on a link from your homepage to your sale page?
Show answer
An internal link with a UTM tag starts a new session and replaces the original source. A visitor who came from paid search would then be recorded under the internal tag instead.