Sub topic 12
Set up tracking before launch
You can only prove a goal was met if the data exists. This chapter assumes you know basic metrics such as clicks and conversion rate, and that you have seen a web analytics or ad platform report. It covers what to set up before launch so the Measurable part of your goal can be checked.
Why tracking comes first
Data cannot be collected after the fact. If a campaign runs for two weeks without conversion tracking, those two weeks of orders are not attributed to anything. You also lose the ability to compare the campaign against its baseline.
A goal such as "400 online orders attributed to the spring email campaign" depends on two things. The store must record each order as a conversion event, and each order must carry a label that links it to the email campaign.
The tracking checklist
Work through these items before the first send or ad impression.
- Define the conversion event. Name the single action that counts toward the goal, such as
purchaseornewsletter_signup. Use the same definition as the goal statement. - Install the tracking. Add the analytics tag or the ad platform pixel to the pages where the event happens, such as the order confirmation page.
- Tag every campaign link. Add UTM parameters (query-string labels that tell analytics where a visit came from) to each link you control.
- Test end to end. Click a tagged link, complete a test conversion, and confirm it appears in the report under the right campaign.
- Record the baseline. Save the current figures, such as the 300 orders from the previous two months, before the campaign changes them.
- Choose an attribution rule. Decide how credit is assigned when a customer touches more than one channel, and write it into the goal.
Tagging links with UTM parameters
UTM parameters are added to the end of a URL. The three most used are utm_source, utm_medium and utm_campaign. This Python snippet builds a tagged link, so every link follows the same naming pattern.
from urllib.parse import urlencode
def tag_link(url, source, medium, campaign):
params = {
"utm_source": source,
"utm_medium": medium,
"utm_campaign": campaign,
}
return url + "?" + urlencode(params)
print(tag_link("https://example.com/spring-sale", "newsletter", "email", "spring_email"))The output is https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_email.
Keep names lowercase and consistent. Analytics tools treat Email and email as different values, which splits one channel across several rows.
How the data flows
If any step breaks, the report is wrong without any visible error. That is why the end-to-end test matters.
Attribution limits
Attribution is the rule that decides which channel gets credit for a conversion. Last-click credits the final touch. Other models share credit across touches. Different tools may report different totals for the same campaign, so name the source of truth in the goal. In the YAML goal record used in this tutorial, the measurable_via field does this job, for example "Landing page conversion events in web analytics".
Common errors
- The pixel fires on page load but not on the confirmation page, so conversions are missed.
- Tags are inconsistent, so one campaign appears under several names.
- Test purchases are not filtered out, so counts are inflated.
- The baseline is recorded after launch, so there is nothing to compare against.
Exercise
Your goal is 400 email-attributed orders. The campaign launches Monday. On Friday you find the order confirmation page has no tracking tag. Name two problems this causes and one thing to do first.
Show answer
Orders placed before the tag was added are not recorded, so the campaign count will be too low and cannot be recovered. The report also cannot be checked against the baseline for that period. First, add the tag and run an end-to-end test with a tagged link, then note the gap in the goal's review notes so the target or comparison can be adjusted.