Sub topic 12
Set up tracking before launch
A SMART goal is only measurable if the data exists when the campaign runs. You can't recover clicks or conversions that were never recorded. This chapter covers the tracking work you finish before the first ad or email goes out: conversion events, link tagging, attribution rules, and a pre-launch test.
This chapter assumes you know common metrics such as clicks, click-through rate and conversion rate. It also assumes you can open a web analytics or ad platform report. The examples use generic terms, so they apply to Google Analytics 4, Adobe Analytics, Matomo or a similar tool.
Why tracking comes before launch
The Measurable letter of SMART says the goal needs a number and a way to read it. Tracking is that way to read it. Three problems follow when tracking is added after launch:
- No baseline. You can't compare against the period before the campaign if the event was not recorded then.
- Lost early data. The first days of a campaign often carry the heaviest spend and the most traffic. Gaps there can't be filled in later.
- Disputed results. If two tools report different numbers and no rule says which one counts, the review meeting becomes an argument about data.
Treat tracking as part of the goal, not as an add-on. The goal statement names a metric, and the tracking plan says exactly where that metric is recorded.
The working model: goal, event, source, report
Every goal metric needs a chain that runs from the customer's action to a number in a report.
A break at any step makes the final number wrong. Common breaks are an untagged link, an event that never fires, or an attribution window that differs from the one you assumed when setting the target.
Start by writing a tracking plan that maps each goal metric to its event and its source of truth. For the spring email goal in this tutorial series, the plan looks like this:
| Goal metric | Event that counts it | Where it is recorded | Source of truth |
|---|---|---|---|
| Email-attributed online orders | `purchase` with order ID | Web analytics, e-commerce tracking | Analytics, reconciled weekly with the order system |
| Newsletter sign-ups from paid social | `newsletter_signup` | Landing page form submit | Web analytics conversion report |
| Cost per session | Ad spend divided by sessions | Ad platform and analytics | Ad platform for cost, analytics for sessions |
The last column is the one people skip. When the ad platform says 450 conversions and analytics says 380, you need a rule written in advance that says which figure is the official one.
Step 1: Define the conversion events
A conversion event is a specific action that the analytics tool records, such as a purchase, a form submission or a download. Pick events that match the KPI in the goal, not a nearby proxy.
Follow these rules:
- One event per goal metric. If the goal counts orders, track
purchase, notadd_to_cart. Add-to-cart events are useful diagnostics, but they are not the goal. - Attach the values you need. For revenue goals, send the order value, currency and a unique order ID. The order ID lets you remove duplicates.
- Fire the event on confirmation. Trigger a purchase event on the order confirmation, not on a button click. A click can fail at payment.
- Mark it as a conversion in the tool. Many tools record events without counting them as conversions until you flag them.
For funnel goals earlier than purchase, such as sign-ups or lead forms, apply the same rules. Fire the event only after the form is accepted, not when the visitor clicks submit.
Step 2: Tag every campaign link
Analytics tools learn where a visit came from through the referrer and through UTM parameters. A UTM parameter is a tag added to the end of a URL, such as utm_source=email. The referrer is often missing or misleading, for example in email apps, mobile apps and messaging tools. Visits from those sources are often filed as "direct" unless the link carries tags.
The standard parameters are:
utm_source: where the traffic comes from, for examplenewsletterorfacebook.utm_medium: the type of channel, for exampleemailorpaid_social.utm_campaign: the campaign name, for examplespring_2026.utm_content: optional, distinguishes variants such as two buttons or two ads.
Tags are case-sensitive in most tools, so Email and email become two separate rows in a report. Build links with a script or template instead of typing them by hand:
from urllib.parse import urlencode
ALLOWED_MEDIUMS = {"email", "paid_social", "cpc", "organic_social"}
def build_tagged_url(base_url, source, medium, campaign, content=None):
"""Return base_url with consistent, lowercase UTM parameters."""
if medium not in ALLOWED_MEDIUMS:
raise ValueError(f"Unknown medium: {medium}")
params = {
"utm_source": source,
"utm_medium": medium,
"utm_campaign": campaign,
}
if content:
params["utm_content"] = content
cleaned = {key: value.strip().lower().replace(" ", "_")
for key, value in params.items()}
separator = "&" if "?" in base_url else "?"
return base_url + separator + urlencode(cleaned)
print(build_tagged_url(
"https://example.com/spring-sale",
source="newsletter",
medium="email",
campaign="Spring 2026",
content="hero button",
))
# https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_2026&utm_content=hero_buttonThe function rejects any medium that is not on the approved list, so a typo such as e-mail fails at build time and not in the report three weeks later.
Do not put UTM tags on links that stay inside your own site. An internal tagged link starts a new session and overwrites the real source of the visit.
Step 3: Decide the attribution rules
Attribution is the rule that decides which channel gets credit for a conversion when a customer touched several. Two settings change your numbers:
- Attribution model. Last-click gives all credit to the final touch. Data-driven or position-based models split credit across touches. Last-click favors channels near the purchase, such as email and branded search. It undervalues channels that create awareness.
- Lookback window. This is how many days before the conversion a touch can still earn credit. A 7-day window and a 30-day window can produce very different order counts for the same campaign.
Write both settings into the goal's measurement note. The goal "400 email-attributed orders" is ambiguous until you add "last-click, 30-day window, as reported in web analytics". Use the same model for the baseline period, or the comparison is not valid.
Step 4: Test before launch
Run a test on the live tracking setup, not just in a preview tool. Use this checklist:
- Click each tagged link from a clean browser session and confirm the visit appears in the real-time report with the right source, medium and campaign.
- Complete a test conversion, such as a small order or a form submission, and confirm the event appears once, with the right value and order ID.
- Check that the event still fires after the redirects, consent banner and payment steps your visitors will pass through.
- Test on mobile and desktop. Many tracking faults are specific to one browser or to in-app browsers.
- Confirm that internal traffic, such as your team and agency, is filtered out so test sessions do not inflate results.
- Confirm the ad platform and analytics tool share the same conversion definition.
Keep the test results with the tracking plan. They show later that the numbers can be trusted.
Record the baseline and the checkpoints
Tracking should be live before launch partly so you can capture a baseline. Pull the last two comparable periods, such as the previous two months for a spring campaign, and write down the values for each goal metric. The target on the goal statement is judged against these numbers.
Also schedule the review points now. The time-bound part of the goal sets checkpoints, and each checkpoint needs a report that already works. A plan can keep this in one place:
tracking_plan:
goal_metric: email_attributed_orders
event: purchase
unique_key: order_id
attribution:
model: last_click
lookback_days: 30
source_of_truth: web_analytics
reconciliation: weekly comparison with order system
baseline:
period: 2026-01-01 to 2026-02-28
value: 300
tests_passed_on: 2026-02-26
checkpoints: [2026-03-31, 2026-04-30]Common errors
| Error | Effect | Fix |
|---|---|---|
| Inconsistent tag spelling (`Email`, `email`, `e-mail`) | One channel split across several report rows | Build links from a template with an approved list |
| Event fires on button click, not confirmation | Conversions overcounted | Fire on the confirmation page or server response |
| No unique order ID | Reloads create duplicate purchases | Send a transaction ID and deduplicate |
| Different attribution settings across tools | Totals never match | Fix one model and window and record them in the plan |
| Tags on internal links | Real source overwritten | Tag only links that enter the site from outside |
| Tracking tested only in preview mode | Failures found after launch | Test on the live site with a real conversion |
| No baseline captured | Target can't be judged | Export the prior periods before launch |
Exercise
Your goal is "Generate 400 online orders attributed to the spring email campaign between 1 March and 30 April." Two days before launch, the team finds that the email links have no UTM tags and the purchase event fires when the customer clicks "Pay", not after payment is accepted. List the fixes you need to make and explain what would go wrong with the goal if you did not make them.
Show answer
Fixes: (1) Add UTM tags to every email link using a shared builder, with source, medium email and a campaign name. (2) Move the purchase event to the order confirmation and send the order value and a unique order ID. (3) Record the attribution model and lookback window in the goal's measurement note, and test the setup with a real conversion. Without the first fix, many email visits would be filed as direct traffic, so email-attributed orders would be undercounted and you could miss a goal you actually met. Without the second, failed payments would be counted as orders, so you could report 400 orders when fewer were placed. Without the third, the number could change depending on who runs the report.