Sub topic 5
Checking links and tracking parameters
This chapter assumes you can use an email platform, know what a merge tag and a segment are, and can read basic HTML links (<a href="...">). It covers what to verify about every link in a campaign before you send, and how to automate part of that check.
Why links fail quietly
A broken link does not stop a send. The email goes out, recipients click, and they land on a 404 page or the wrong offer. You find out from complaints or from a click report that looks too good or too bad.
Link problems fall into a few groups:
- Dead or wrong destinations. The URL has a typo, points to a page that was unpublished, or points to a staging site.
- Redirect problems. The link passes through several redirects, or ends on a login page the recipient cannot use.
- Tracking problems. UTM parameters are missing, misspelled or inconsistent, so analytics reports split or lose the campaign's traffic.
- Personalization problems. A merge tag inside a URL is empty for some contacts, which produces a malformed link.
- Platform rewriting. The email platform replaces your URL with its own click-tracking URL, and that rewritten URL behaves differently from the original.
Test sends are the right place to catch these, because a test send shows the links after the platform has processed them.
What to check on every link
Go through each link in the email, including the logo, the footer and image links. Use this list:
- The destination is correct. Click the link from the test email, not from the editor. Confirm that the page matches what the surrounding copy promises.
- The page loads. Check for 404 or 500 errors, expired offers and pages that require a login.
- The protocol is HTTPS. An
http://link can trigger browser warnings, and some clients flag it. - The destination is on the right site. Look for staging domains,
localhost, or preview URLs copied by mistake. - Tracking parameters are present and correct. See the next section.
- The link works on mobile. Open it on a phone. Some pages load a different layout or an app-install prompt.
- Link text matches the destination. If the visible text shows
example.com/sale, the underlyinghrefshould go to that page. A mismatch looks like phishing to both people and filters.
Do not forget non-web links. A mailto: link should open a message to the correct address, and a tel: link should hold a full number with country code.
Tracking parameters
A tracking parameter is a key and value added to the end of a URL after a ?, such as utm_campaign=spring_sale. Analytics tools read these values when a visitor arrives and use them to attribute the visit to a campaign. The common UTM parameters are:
| Parameter | Meaning | Example value |
|---|---|---|
| `utm_source` | Where the traffic comes from | `newsletter` |
| `utm_medium` | The channel type | `email` |
| `utm_campaign` | The specific campaign | `spring_sale_2026` |
| `utm_content` | Which link or variant within the email | `hero_button` |
| `utm_term` | Optional, mostly for paid search keywords | `running_shoes` |
A complete link looks like this:
https://www.example.com/sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale_2026&utm_content=hero_buttonCommon tracking errors
- Inconsistent spelling or case.
Email,emailande-mailappear as three separate mediums in most analytics reports. Choose one convention, such as lowercase with underscores, and write it down. - Missing parameters on some links. One forgotten footer link sends untagged traffic that shows up as "direct".
- Two question marks. If the URL already has a query string, extra parameters must be joined with
&, not a second?. - Spaces and special characters. Spaces must be encoded (
%20) or avoided. Use letters, digits, hyphens and underscores in values. - Tagging internal links. UTM parameters on links that go between pages of your own site can overwrite the original traffic source. Use them only on links that bring people in from the email.
- Reusing last month's campaign name. Copying an old email carries the old
utm_campaignwith it, and the results merge into the earlier campaign.
Many platforms can append UTM parameters automatically. Check whether the platform's setting adds them in addition to ones you typed by hand, since that can produce duplicates.
Links that contain merge tags
Some links include a merge tag, for example a personalized account link or a product ID. These need two tests:
- Send to a seed contact with all fields filled in, and confirm that the link resolves to the right page.
- Send to a seed contact with the relevant field empty, and look at the resulting
href. An empty value can producehttps://example.com/account/orhttps://example.com/account/?id=, which may lead to an error page.
Where a field can be empty, give the tag a fallback or link to a page that works without it. The next chapter on personalization covers fallback values in detail. The point here is that you must open the link in the test email to know the outcome, because the editor preview often fills in sample data.
Platform click tracking and redirects
Most platforms rewrite each link so that the click goes first to the platform's tracking server, which records it and then forwards the visitor to your page. This has several consequences for testing:
- The link in the test email will not look like the URL you typed. That is normal.
- The click goes through one extra redirect. If the tracking domain is slow or blocked, the link feels broken.
- If the platform uses a shared tracking domain, its reputation affects you. Some platforms allow a custom tracking domain on your own domain, which needs its own DNS setup and an HTTPS certificate.
- Link text that shows a URL can be rewritten in the HTML but not in the visible text, which creates the mismatch described earlier. Check that your platform handles visible URLs the way you expect.
- Some links should not be tracked, such as password-reset or one-time sign-in links. Check whether your platform lets you turn tracking off for a specific link.
After clicking, look at the final URL in the browser address bar. It should be your destination with your UTM parameters intact, and no leftover tracking-system parameters that you did not expect.
Automating part of the check
Manual clicking is necessary, but it is slow for an email with thirty links. A short script can check the first-pass items: whether each link responds and whether it carries utm_campaign. Save the HTML of the email (for example, from the platform's "export HTML" option or from a test email's source) and run this script against it.
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 utm_campaign is present, and the URL.
How to read the output:
200means the page responded. A301or302is a redirect, which is often fine but worth a manual look.404or500needs a fix.- A line marked
NO-UTMis a link without a campaign tag. That may be intentional for the unsubscribe link, which should usually not be tagged, but check each one.
Limits of the script
- Some servers reject
HEADrequests or block unknown user agents and return403or405even though the page works in a browser. A failure means "check manually", not "broken". - The script reads only absolute
httpandhttpslinks in double-quoted attributes. It skipsmailto:,tel:and single-quoted attributes. - If you run it on HTML exported from the editor, merge tags may still be unresolved, so the URLs will contain tag syntax. Run it on the source of a delivered test email when possible.
- The script cannot tell whether the page content matches the email's promise. A human has to judge that.
A practical routine
- Send a test email to your seed list, including a contact with empty merge fields.
- Run the script on the delivered HTML and list the failures and
NO-UTMlines. - Click every link in the delivered email on desktop. Click the key calls to action on a phone.
- Compare each final URL with a link map: a short table of link, intended destination and
utm_contentvalue. Keep it with the campaign so the next person can reuse it. - Fix problems in the editor, resend a test, and re-check only what changed. Look at all links again if you edited the template, since one change can affect shared blocks.
Exercise
A test email goes out with a link to https://example.com/offer?id={{ product_id }}. In the delivered email, the link for a seed contact with an empty product field reads https://example.com/offer?id=. The editor preview showed a working link. What went wrong, why did the preview miss it, and what should you do?
Show answer
The merge tag resolved to an empty string for the contact with no product ID, which produced an incomplete URL that likely leads to an error or a generic page. The editor preview filled in sample data, so it hid the problem. Test with a seed contact whose field is empty, open the link in the delivered email, and fix it by adding a fallback value or linking to a page that works without the ID.
Exercise
Your link-check script prints 403 NO-UTM https://shop.example.com/sale for one link. List two things you should do before deciding the link is a problem.
Show answer
First, open the link in a browser, because many servers return 403 for scripted HEAD requests while the page works normally. Second, decide whether the missing utm_campaign is a mistake. If the link brings people in from the email, add the UTM parameters. If it is a link that should not be tagged, such as an unsubscribe link, leave it as is.