Sub topic 9
Tagging Links and Attributing Results
This chapter assumes you understand basic social media goals such as awareness, traffic, and sales. You should also be comfortable reading simple percentages and ratios.
Why link tagging matters
A social platform can report clicks, but your website analytics needs to know where those visitors came from. Link tagging adds information to a URL so an analytics system can classify the visit.
A UTM parameter is a name-value pair added to a URL for campaign tracking. UTM stands for Urchin Tracking Module, the naming system used by many analytics tools.
A tagged URL might look like this:
| Parameter | Example value | What it identifies |
|---|---|---|
| `utm_source` | `instagram` | The platform or traffic source |
| `utm_medium` | `paid_social` | The type of traffic |
| `utm_campaign` | `spring_sale` | The campaign |
| `utm_content` | `video_a` | The creative or link variation |
| `utm_term` | `running_shoes` | Often a keyword or audience label |
Use the same naming rules everywhere. For example, choose either paid_social or paid-social, and do not alternate between them. Analytics tools usually treat different spellings as different values.
Distinguishing organic and paid traffic
The most important distinction for this topic is the medium. Use a value such as organic_social for unpaid posts and paid_social for advertisements.
These two links lead to the same page, but analytics can separate their traffic:
https://example.com/spring-sale?utm_source=instagram&utm_medium=paid_social&utm_campaign=spring_sale&utm_content=video_a
https://example.com/spring-sale?utm_source=instagram&utm_medium=organic_social&utm_campaign=spring_sale&utm_content=video_aThe source and campaign remain the same. The medium tells you whether the visit came from paid or organic distribution.
Keep the values short and readable. Lowercase names with underscores reduce accidental differences. Create a campaign naming guide that records approved values before publishing links.
Building tagged URLs
A URL builder reduces typing mistakes. This example creates a tagged link from a base page and a dictionary of parameters:
from urllib.parse import urlencode
def tagged_url(base_url, source, medium, campaign, content=None, term=None):
parameters = {
"utm_source": source.lower(),
"utm_medium": medium.lower(),
"utm_campaign": campaign.lower(),
}
if content:
parameters["utm_content"] = content.lower()
if term:
parameters["utm_term"] = term.lower()
separator = "&" if "?" in base_url else "?"
return f"{base_url}{separator}{urlencode(parameters)}"
paid_link = tagged_url(
"https://example.com/spring-sale",
source="instagram",
medium="paid_social",
campaign="spring_sale",
content="video_a",
)
print(paid_link)Test the finished link before publishing it. Confirm that it opens the intended page, preserves any existing query parameters, and records the visit in your analytics system.
Choosing an attribution view
Attribution is the method used to assign credit for a conversion to one or more interactions. A last-click model gives all credit to the final tracked interaction. A first-click model gives credit to the first interaction. A data-driven model may distribute credit across several interactions.
Compare results using the same model and time period. If the social platform reports conversions using its own view-through or click window, its total may not match your website analytics. Document the conversion event, attribution window, time zone, and model used in each report.
Read tagged traffic together with platform metrics:
- Compare link clicks with analytics sessions to find tracking or loading problems.
- Compare sessions with conversions to calculate the landing-page conversion rate.
- Compare paid and organic mediums to see whether each produces traffic and sales.
- Check campaign and content values to learn which message or creative performs best.
A simple attribution workflow
- Define the campaign, source, medium, and creative names.
- Add UTM parameters to every external social link.
- Test each link and record it in a campaign log.
- Confirm that analytics receives the source and campaign values.
- Report traffic, conversions, and revenue by consistent dimensions.
- Review differences between platform reports and website reports before changing budget.
Exercise
An Instagram post and an Instagram ad promote the same spring sale. Which UTM parameter should distinguish the two traffic sources, and what values could you use?
Show answer
Use utm_medium. Use organic_social for the unpaid post and paid_social for the advertisement. Keep the source, campaign, and content values consistent when they refer to the same platform, campaign, and creative.