UTM tracking in Segment
Segment's analytics.js library automatically parses UTM parameters from the page URL into the standardised context.campaign object on every event, and forwards that context to connected destinations. Understanding this mapping lets you tag links once and have campaign data flow consistently into every tool wired to Segment.
UTM to context.campaign
Segment's analytics.js maps UTM parameters into a structured context.campaign object on every call. utm_source becomes campaign.source, utm_medium becomes campaign.medium, utm_campaign becomes campaign.name, utm_term becomes campaign.term, and utm_content becomes campaign.content.
Because the mapping is standardised, downstream destinations receive a consistent campaign shape regardless of which raw query string the visitor arrived on. Any non-UTM query parameters can also be surfaced, but the five standard UTMs map to the named campaign fields.
- utm_source to campaign.source, utm_medium to campaign.medium
- utm_campaign to campaign.name, utm_term to campaign.term, utm_content to campaign.content
- Read client-side from the page URL when the event fires
Forwarding to destinations
Once UTM data sits in context.campaign, Segment forwards it with the event to connected destinations, each of which maps the campaign fields into its own model. This is the value of doing it once at the source: tag a link, and every downstream tool inherits the same channel labels.
Keep values lowercase and consistent so each destination groups the channel cleanly. Drift introduced at the link level propagates to every connected tool at once.
How it appears in analytics and logs
When a Segment event carries a populated context.campaign object, analytics.js read UTM parameters from the landing URL. An empty campaign context means the page URL had no UTM parameters when the snippet ran, or a redirect removed them first.
Diagnostic use case
Confirm that tagged links populate Segment's context.campaign object and reach downstream destinations, so every connected tool shares the same campaign attribution from a single instrumentation point.
What WebmasterID can help detect
WebmasterID captures the inbound campaign hit server-side, so you can verify that arrivals Segment forwarded as campaign context match the tagged traffic actually reaching your origin, independent of any client-side library.
Common mistakes
- Assuming context.campaign populates after a redirect stripped the UTM query string.
- Inconsistent casing that fragments a channel across every connected destination.
- Placing personal data in UTM values that fan out to many destinations.
- Expecting non-standard query parameters to land in the named campaign fields.
Privacy and accuracy notes
Segment's campaign context describes the marketing source, not the individual. Keep personal data out of UTM values, because context.campaign is forwarded to many destinations and can be retained by each one.
Related pages
- UTM tracking in Mixpanel
Mixpanel's JavaScript SDK automatically captures the five standard UTM parameters from the page URL and stores them as properties on tracked events, and can persist the first values as user profile properties. This makes UTM the basis for acquisition-channel breakdowns in Mixpanel without extra instrumentation, provided you understand when the values are read and how they persist.
- UTM and server-side tracking
Server-side tracking reads the UTM parameters from the incoming HTTP request on your server, rather than relying on a browser tag to capture them. This makes campaign attribution resilient to ad blockers, script failures, and consent-gated client tags. The trade-off is that the server sees the landing request but must be designed to persist the campaign context across the visit. This page covers the mechanics and limits.
- UTM in Google Analytics 4
Google Analytics 4 reads the standard utm_ query parameters and maps them to its session and traffic-source dimensions. The mapping is specific: utm_source, utm_medium, and utm_campaign feed the core dimensions, utm_id powers the manual campaign ID, and utm_source/medium combinations drive GA4's default channel grouping. Knowing the exact mapping prevents tags that look fine but land in the wrong channel.
- Campaign links docs
Tag links once so every connected tool shares the channel.
Sources and verification notes
- Segment Docs — UTM parameters and context.campaignanalytics.js parses UTM parameters into the context.campaign object.
Last reviewed 2026-06-24. Facts are checked against primary/official sources where available; uncertain specifics are marked “Data not yet verified” rather than guessed.