Sub topic 5
Checking links and tracking parameters
This chapter assumes you can send a test email from your platform, know what a merge tag is, and can read a basic HTML link (<a href="...">). It covers the link checks you run on a test send, before the campaign goes to the whole list.
Why links fail
A broken link is one of the most common campaign errors, and a test send is the only place you can catch it cheaply. Links break in a few predictable ways:
- The URL has a typo, or the page was moved or deleted.
- The link points to a staging or preview address instead of the live site.
- The tracking parameters are missing, misspelled, or inconsistent with your other campaigns.
- A merge tag inside the URL renders as empty or as raw template text.
- The platform wraps the link in a click-tracking redirect, and the redirect fails.
Click-tracking redirects deserve a note. Most platforms rewrite each link so that a click passes through their server first. The link you see in the editor is not always the link the recipient clicks, so always test the link in the received test email, not in the editor.
What UTM parameters are
UTM parameters are query-string fields appended to a URL so your analytics tool can attribute a visit to a campaign. The usual set is:
| Parameter | Purpose | Example value |
|---|---|---|
| `utm_source` | Where the traffic comes from | `newsletter` |
| `utm_medium` | The channel | `email` |
| `utm_campaign` | The specific campaign | `spring_sale_2026` |
| `utm_content` | Which link or variant was clicked | `header_button` |
Analytics tools treat values as case-sensitive text, so Email and email appear as two separate rows in reports. Pick a naming convention (lowercase, underscores) and use it every time.
Manual checks on the test email
Open the test email you received and go through every link:
- Click each link, including the logo, images, buttons, and footer links.
- Confirm the destination is the live page and the content matches what the email promised (the right product, the right discount code).
- Check the address bar for the expected UTM parameters.
- Confirm that links with merge tags, such as a personalized account URL, work for a seed contact and for one with empty fields.
- Try the link on a phone, because some links open an app or a different page on mobile.
Automating the check
If the email has many links, check them with a script. Save the HTML of the email, then run the script below. It requests each link and reports whether it has a utm_campaign parameter.
import re
import sys
from urllib.error import HTTPError, URLError
from urllib.parse import parse_qs, urlparse
from urllib.request import Request, urlopen
def extract_links(html):
return re.findall(r'href="(https?://[^"]+)"', html)
def status_of(url):
req = Request(url, method="HEAD", headers={"User-Agent": "link-check"})
try:
with urlopen(req, timeout=10) as resp:
return resp.status
except HTTPError as err:
return err.code
except URLError as err:
return str(err.reason)
with open(sys.argv[1], encoding="utf-8") as f:
html = f.read()
for url in extract_links(html):
params = parse_qs(urlparse(url).query)
has_utm = "utm_campaign" in params
print(status_of(url), "utm_campaign" if has_utm else "NO-UTM", url)Run it with python check_links.py email.html. Each output line shows the status code, whether the UTM parameter is present, and the URL.
Reading the results
- Status 200: the page loaded. Still confirm it is the right page.
- Status 301 or 302: a redirect. Check that it ends on the intended page and that the UTM parameters survive the redirect, since some redirects drop the query string.
- Status 404 or 5xx: the page is missing or the server has an error. Fix the URL before sending.
- NO-UTM: the link lacks tracking. This is correct for the unsubscribe link and some external links, and a mistake for links to your own site.
The following diagram shows the order of the checks.
Exercise
Your script reports status 405 for one link, and the link works when you click it in a browser. What is the likely cause, and what should you do next?
Show answer
The server probably rejects HEAD requests, which is why the script gets 405 (Method Not Allowed). The link itself is likely fine. Confirm by clicking it in the received test email, and check that the destination page and UTM parameters are correct.
Exercise
Your analytics report shows two rows for the same campaign, "SpringSale" and "springsale". What went wrong, and how do you prevent it?
Show answer
The utm_campaign values differ in case, and analytics tools treat them as separate values. Prevent it with a written naming convention (lowercase with underscores) and by checking the parameters on every link in the test email.