Sub topic 5
Source, medium, and campaign
This chapter assumes you can open the Reports section of a GA4 property and that you know the difference between a user and a session from earlier chapters. It covers three dimensions that label where traffic came from, how GA4 fills them in, and how they go wrong.
What the three dimensions mean
GA4 describes a traffic origin with three related dimensions.
- Source is where the visitor was before arriving. Examples are
google,newsletter, ornews.example.org. - Medium is the general kind of link or channel. Examples are
organic,cpc,email,referral, or(none). - Campaign is the name of a marketing effort, such as
spring_sale.
Source and medium are almost always read together as source / medium, for example google / organic or newsletter / email. Reports show this pair as a single combined dimension.
Where the values come from
GA4 reads these values from the page URL and the referrer when a session starts. It applies the following sources of information, roughly in this order.
- Campaign tags in the URL. The parameters
utm_source,utm_medium, andutm_campaignset source, medium, and campaign directly. - Google Ads auto-tagging. When a Google Ads account is linked and auto-tagging is on, the
gclidparameter identifies the click. GA4 reports it asgoogle / cpcand pulls the campaign name from Ads. - The HTTP referrer. If there are no tags, GA4 looks at the referring site. Known search engines become
<engine> / organic. Other sites become<domain> / referral. - Nothing. With no tags and no referrer, the source is
(direct)and the medium is(none).
Tag precedence has a nuance. If a URL has both a gclid and UTM parameters, the result depends on the "manual tagging overrides auto-tagging" setting in the Google Ads link. Check that setting before you tag links that point at Google Ads traffic.
Building a tagged link
A tagged link adds query parameters to the destination URL.
https://www.example.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=spring_saleFor sessions that arrive through this link, GA4 shows source newsletter, medium email, and campaign spring_sale. The source / medium value is newsletter / email.
There are two more optional parameters, utm_term and utm_content. They fill the Manual term and Manual ad content dimensions. They are useful for keywords and for A/B testing two links in the same campaign.
Tagging conventions that prevent trouble
GA4 treats tag values as case-sensitive text. Email, email, and E-mail become three different rows. The mismatch also affects channel grouping, because the default rules match on specific medium values. Agree on a convention and write it down.
| Rule | Good | Avoid |
|---|---|---|
| Lowercase everything | `utm_medium=email` | `utm_medium=Email` |
| Use underscores, not spaces | `spring_sale` | `Spring Sale` |
| Use standard medium names | `cpc`, `email`, `social`, `affiliate` | `paid-clicks`, `mail-blast` |
| Name the actual source | `utm_source=linkedin` | `utm_source=social` |
| Keep campaign names stable | `spring_sale` | `spring_sale_v2_final` |
> Note: the table above is a convention, not something GA4 enforces.
Do not tag internal links
Never add UTM parameters to links between pages of your own site. A tagged internal click starts a new session in GA4 and replaces the original source with your internal tag. The visit that really came from Google then looks like it came from your own banner, and the original attribution is lost. Use event parameters or a separate click event to measure internal promotions.
Session and first-user versions
Each of the three dimensions exists in more than one scope. Chapter 3 explained scope in general. For these dimensions the pairs are as follows.
| Question | Dimension to use | API name |
|---|---|---|
| What brought this visit? | Session source / medium | `sessionSourceMedium` |
| What brought this visit's campaign? | Session campaign | `sessionCampaignName` |
| What first brought this person? | First user source / medium | `firstUserSourceMedium` |
| What first brought this person's campaign? | First user campaign | `firstUserCampaignName` |
The Traffic acquisition report uses the session versions. The User acquisition report uses the first-user versions. A person who first found you through google / organic and later returned through newsletter / email appears under both, in different reports. That is expected, and not a mismatch.
Reports also use a lookback window. When someone returns with no new source, GA4 may credit the session to their earlier source for a limited time, so a "direct" visit can inherit an earlier campaign. This is one reason direct traffic numbers differ across tools.
Special campaign values
Not all campaign values come from a UTM tag. In session reports you will see these placeholder values.
(direct)for sessions with no referrer and no tags.(organic)for unpaid search traffic.(referral)for traffic from other sites without tags.(not set)when GA4 has no campaign information to report.
A (not set) campaign does not mean data is broken. Most visits do not belong to a tagged campaign, so a large (not set) share is normal for the campaign dimension. A (not set) source or medium is a different matter and needs investigation, which the later chapter on Direct and Unassigned covers.
Querying the dimensions through the Data API
The same dimensions can be requested through the GA4 Data API. This runReport request body lists the top source / medium and campaign combinations.
{
"dateRanges": [{ "startDate": "28daysAgo", "endDate": "yesterday" }],
"dimensions": [
{ "name": "sessionSourceMedium" },
{ "name": "sessionCampaignName" }
],
"metrics": [
{ "name": "sessions" },
{ "name": "engagedSessions" }
],
"orderBys": [{ "metric": { "metricName": "sessions" }, "desc": true }],
"limit": 25
}Swap in firstUserSourceMedium and firstUserCampaignName to get the user-scoped view. Do not mix session-scoped and first-user dimensions in one request when you want a clean comparison, because each pair answers a different question.
Common errors
- Inconsistent case.
Facebookandfacebooksplit one source into two rows. Fix the tagging at the source, because GA4 does not retroactively merge past data. - Wrong medium. A paid newsletter placement tagged
medium=newsletterdoes not match any default channel rule. It lands in Unassigned or another unexpected channel. Use a medium the default channel group recognizes. - Tags lost in redirects. A redirect that drops the query string removes the UTM parameters before GA4 sees them. The session then falls back to the referrer or to Direct. Test every link by clicking it and checking the Realtime report.
- Tags on internal links. This overwrites the real source, as described above.
- Comparing the wrong scope. Putting the User acquisition report next to the Traffic acquisition report and expecting equal numbers will always disappoint.
Exercises
Exercise
A colleague tags two email links, one with utmmedium=Email and one with utmmedium=email. What do you see in the reports, and what is the fix?
Show answer
GA4 shows them as two separate rows because values are case-sensitive, and the capitalized one may also fail the default channel group rule for email. Standardize on lowercase in all future links. Past data stays split unless you handle it in a custom channel group or a report filter.
Exercise
A visitor first arrives from google / organic, then a week later clicks a link tagged utmsource=newsletter&utmmedium=email. Which source / medium does each report credit?
Show answer
The Traffic acquisition report credits the second session to newsletter / email, because it uses session scope. The User acquisition report credits the visitor to google / organic, because it uses first-user scope.