Sub topic 13
Tracking links and attribution models
This chapter assumes you know how the main channels work and what CTR, CPA, and ROAS mean. It covers how to label traffic so analytics can tell channels apart. It then covers how attribution models split credit for a conversion among the channels that touched a customer.
Why tracking comes first
A visit arrives at your site with very little information. Analytics tools infer the source from the referrer, which is the page the visitor came from. They also read any tags you added to the link. Without tags, a lot of traffic lands in vague buckets such as "direct" or "referral". Email clicks, app-to-browser handoffs, and some social traffic often arrive with no referrer at all.
Tagging fixes this. You decide the labels, and you apply them in a consistent format. Attribution then uses the tagged data to answer a different question: which touchpoints deserve credit for the result?
UTM parameters
UTM parameters are key-value pairs added to the end of a URL. Google Analytics and most other analytics tools read them. A tagged link looks like this:
https://example.com/spring-sale?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale&utm_content=header_buttonThe page loads as usual. The analytics tool reads the parameters and records the session against those labels.
| Parameter | Answers the question | Example value |
|---|---|---|
| utm_source | Which specific site, list, or platform sent the visit? | newsletter, linkedin |
| utm_medium | Which type of channel was it? | email, cpc, social, affiliate |
| utm_campaign | Which campaign or promotion? | spring_sale |
| utm_content | Which creative or link, for A/B comparison? | header_button |
| utm_term | Which paid keyword (mainly paid search)? | running_shoes |
Source, medium, and campaign are the three you should always set. Content and term are optional refinements.
Naming rules that prevent messy reports
Most UTM problems come from inconsistent labels, not from the technology. Analytics tools treat values as case-sensitive text. Email, email, and e-mail become three separate rows in your report.
- Use lowercase only.
- Use underscores or hyphens, never spaces. Pick one and keep it.
- Keep a short list of allowed
utm_mediumvalues, such asemail,cpc,social,affiliate, anddisplay. Medium values feed the default channel groupings in many tools, so a made-up value can push traffic into "Unassigned" or "Other". - Record every tagged link in a shared spreadsheet or a link builder, with an owner and a date.
- Put dates or IDs in campaign names when you run the same promotion repeatedly, for example
spring_sale_2026.
Paid search and auto-tagging
Google Ads can append a click ID called gclid automatically. Other ad platforms use similar IDs. These IDs let the platform and analytics tool match clicks to cost data and conversions. If you also add manual UTM tags to ads, check your analytics settings to see which one wins when both are present. Some platforms also support ValueTrack or dynamic parameters, such as {campaignid} placeholders. These fill in values at click time so you do not hand-type each ad's tags.
What tagging cannot see
Tagging gives you clean labels, but it does not give you the full picture. Know these gaps before you trust a report.
- Dark social. People share links through messaging apps and private chats. These visits often arrive untagged and show up as direct.
- Email privacy features. Some mail apps preload images, which inflates open counts. Click tracking through tagged links is more reliable than opens.
- Cross-device journeys. A customer may see an ad on a phone and buy on a laptop. Without a login or shared ID, tools treat these as two visitors.
- Consent and blockers. Cookie consent rules and ad blockers remove some visits from your data. The data you see is a sample skewed toward users who allow tracking.
- View-through influence. A display or video ad that someone saw but did not click leaves no UTM trail at all.
From tagged visits to credit: attribution
A conversion rarely follows a single click. A customer might find a blog post through search, see a paid social ad, click an email, and finally search your brand name and buy. An attribution model is a rule for splitting credit for that sale among the touchpoints.
Common models
| Model | How it splits credit | Favors | Weakness |
|---|---|---|---|
| First touch | 100% to the first interaction | Discovery channels such as SEO and content | Ignores everything that closed the sale |
| Last touch | 100% to the final interaction | Closing channels such as brand search and email | Undervalues awareness work |
| Linear | Equal share to every touch | No channel in particular | Treats a casual impression like a decisive click |
| Position-based | 40% first, 40% last, 20% spread across the middle | Opening and closing channels | The weights are arbitrary |
| Time decay | More credit to touches closer to the sale | Late-stage channels | Penalizes long consideration cycles |
| Data-driven | Credit estimated from observed paths by a statistical model | Whatever the data supports | Needs volume, and is hard to audit |
No model is correct in an absolute sense. Each one encodes a belief about how customers decide. The useful question is which model matches the business, and how much the answer changes when you switch.
Comparing models in code
This script applies five rule-based models to the journey in the diagram. It uses a revenue of 100 so the credit reads as a percentage. Because paid search appears only at the end here, the totals also show how a channel that appears twice would be summed.
from collections import defaultdict
def attribute(touches, revenue, model):
n = len(touches)
if model == "first_touch":
weights = [1.0] + [0.0] * (n - 1)
elif model == "last_touch":
weights = [0.0] * (n - 1) + [1.0]
elif model == "linear":
weights = [1 / n] * n
elif model == "position_based":
if n == 1:
weights = [1.0]
elif n == 2:
weights = [0.5, 0.5]
else:
middle = 0.2 / (n - 2)
weights = [0.4] + [middle] * (n - 2) + [0.4]
elif model == "time_decay":
raw = [0.5 ** (n - 1 - i) for i in range(n)]
total = sum(raw)
weights = [w / total for w in raw]
else:
raise ValueError(f"unknown model: {model}")
credit = defaultdict(float)
for channel, weight in zip(touches, weights):
credit[channel] += revenue * weight
return {channel: round(value, 2) for channel, value in credit.items()}
journey = ["organic_search", "paid_social", "email", "paid_search"]
for model in ["first_touch", "last_touch", "linear", "position_based", "time_decay"]:
print(model, attribute(journey, revenue=100, model=model))The output shows organic search receiving 100, 0, 25, 40, and 6.67 under the five models. Paid search receives 0, 100, 25, 40, and 53.33. The same journey and the same sale produce very different channel scorecards.
Why the models disagree, and what to do about it
Last-touch reporting tends to flatter brand search, email, and retargeting, because these channels often sit right before purchase. They capture demand that other channels created. If you cut awareness spend because it looks weak in last-touch reports, brand search volume usually falls a few weeks later.
Platforms also report their own conversions. A social ad network will often count a conversion if someone saw an ad and later bought, even without a click. Ad platforms and analytics tools therefore claim overlapping credit, and the sum of all platform reports can exceed your actual sales. Treat your own order data as the source of truth, and use platform numbers as directional.
Practical habits that reduce the confusion:
- Pick one primary model for routine reporting, and write down which one it is.
- Compare it against at least one other model each quarter. Channels whose rank changes a lot are the ones where the model choice matters most.
- Check totals against revenue in your store or CRM.
- Where a channel's contribution is hard to see, test it. Pause spend in one region or run a holdout group, and measure the change in sales. An incrementality test like this shows what a channel adds, which no attribution model can prove.
- Match the lookback window to the buying cycle. A 7-day window suits low-priced impulse items. A B2B sale with a long evaluation may need 60 to 90 days.
Common errors
- Tagging internal links, which overwrites the real source.
- Mixing
Emailandemail, which splits one channel into two rows. - Using different
utm_mediumvalues for the same channel across teams. - Judging awareness channels on last-touch conversions alone.
- Adding platform-reported conversions together and treating the total as real.
- Changing the attribution model mid-quarter and then comparing results with earlier periods.
Exercise
A marketer sends a newsletter linking to a sale page. In the report, traffic appears under three source rows: "Newsletter", "newsletter", and "news-letter". Name the cause, and give two rules that would prevent it.
Show answer
The cause is inconsistent UTM naming. Analytics tools treat values as case-sensitive text, so each spelling becomes its own row. Prevention: use lowercase only, and keep a shared list of approved source and medium values (for example, always newsletter), logged in a link-tracking sheet or builder that everyone uses.
Exercise
A customer finds your site through an organic search for a blog post, then clicks a paid social ad, then buys after clicking a retargeting ad. Which credit does each of these models give to the blog post: first touch, last touch, and linear? Which model would make the blog look most valuable?
Show answer
First touch gives the blog post 100%. Last touch gives it 0%, because the retargeting ad was the final click. Linear gives it one third, about 33%, because there are three touches. First touch makes the blog look most valuable.