Traffic-source dimensions

[GA4] Campaigns and traffic sources

In this article:

Overview

Users arrive at your website or application through a variety of sources, including advertising campaigns, search engines, and social networks. This article describes how Analytics collects, processes, and reports the campaign and traffic-source data.

Understanding campaigns & traffic sources

In Analytics, the ad campaigns, search engines, social networks, and other sources that send users to your property are collectively known as campaigns and traffic sources. The process by which campaign and traffic-source data is sent to Analytics and populated in reports has the following steps:

Collection, processing, and reporting behavior can be customized.

Collection

The Analytics SDKs and tracking code use these fields when sending campaign and traffic-source data:

Field Name Variable to set Protocol Parameter Sample Value Field Description
Campaign Id campaign.id &ci abc123 Sets the unique campaign ID which can be used later for cost-data widening.
Campaign Source campaign.source &cs email_promo Sets the source dimension in reports.
Campaign Medium campaign.medium &cm email Sets the medium dimension in reports.
Campaign Name campaign.name &cn january_boots_promo Sets the campaign name dimension in reports.
Campaign Content campaign.content &cc email_variation1 Sets the content dimension in reports.
Campaign Term campaign.term &ck winter%20boots Sets the term dimension in reports.
Document Location page_location &dl http://store.example.com/boots?utm_source=email_promo&utm_medium=email&utm_campaign=january_promo &utm_content=copy_variation1 Sets dimensions when custom campaign (utm) parameters are embedded.
Document Referrer page_referrer &dr http://blog.blogger.com/boots Describes the referring source and may set dimensions when no other campaign or traffic source fields have been set.

Each session is associated with only one campaign or traffic source and a new session is not started when Google Analytics 4 encounters a new campaign or traffic source. When new campaign or traffic-source values are sent to Analytics at collection time in the middle of an existing session, those values are associated with the events for which they were collected and the data is used for event-based attribution, but the campaign and traffic-source values are not associated with the existing session of the user.

Processing

During processing, traffic-source and campaign field values are finalized into dimension values and attributed to sessions.

The following method applies to processing that uses utm_ parameter values (e.g., display, social, email, paid search, etc.).

  • Source precedence—A direct-traffic visit that follows a referred visit will never override an existing referrer.

Processing custom campaigns

A session is processed as a custom campaign when custom campaign parameters are embedded in the document location field. When a custom campaign is processed, the values of the custom-campaign parameters map directly to the dimensions in reports.

For example, the following document location field value:

&dl=http://store.example.com/boots
?utm_source=promo_email
&utm_medium=email
&utm_campaign=january_promo
&utm_id=123abc
&utm_content=copy_variation1

would be processed into the following final dimension values:

source=promo_email
medium=email
campaign=january_promo
id=123abc
content=copy_variation1

Processing paid search-engine referrals

A session is processed as a paid-search referral when custom campaign parameters or Google Ads / Google Marketing Platform click IDs are used in the ad's destination URL and are sent to Analytics in the document location field.

Learn more about how to verify that Google Ads auto-tagging is working.

If custom campaign parameters or click IDs are not used, the session may be processed as organic instead.

Processing organic search-engine referrals

Search-engine referral data is processed by comparing the hostname and query parameter of the document referrer field to a list of known search engines and their query parameters. The first known search engine that matches both the hostname and query parameter of the document referrer value is used to set the report dimension values.

Note that most Google searches are performed via HTTPS, which causes the keyword dimension to automatically be set to (not provided).

Processing direct traffic

A session is processed as direct traffic when no information about the referral source is available, or when the referring source or search term has been configured to be ignored. Learn more about referrer exclusions.

Reporting

After processing, the following campaign and traffic source dimensions and metrics are available in reports:

Dimensions

Web Interface Scope Core Reporting API Description
Source

User

Session

Event

firstUserSource

sessionSource

source

The source of referrals to your property.
Medium

User

Session

Event

firstUserMedium

sessionMedium

medium

The type of referrals to your property (e.g. email, cpc, etc.)
Campaign ID

User

Session

Event

firstUserCampaignId

sessionCampaignId

campaignId

 
Campaign Name

User

Session

Event

firstUserCampaignName

sessionCampaignName

campaignName

The name of a marketing campaign sending users to your property

In the case of paid Google Ads or Google Marketing Platform campaigns, there are additional fields that can be populated manually by importing cost data.

If your Google Ads account isn’t linked to Analytics but auto-tagging is enabled and appends a Google Click ID (gclid) to the end of your URL, unlinked Google Ads campaigns will still appear in reports by default with a source/medium of google/cpc or using available UTM values. No campaign data will be included for these campaigns and related ad clicks will not be used for Google paid channels attribution.

Advanced configuration options

The following advanced configuration options may be set at the property level:

Attribution settings and campaign key event lookback window

Attribution is the act of assigning credit for key events to different ads, clicks, and factors along a user's path to completing a key event.

The campaign key event lookback window determines how far back in time a touchpoint is eligible for attribution credit.

Learn how to configure attribution settings and the campaign key event lookback window.

Excluding referrers

You can exclude certain referring sources from reports by setting these exclusions at the property level.

Google Analytics 4 now automatically prevents self-referrals: you no longer have to enter your domains when the referring page matches the domain of the current page or when you've already configured your property for cross-domain measurement.

You will however still want to configure referral exclusion for any third-party services or gateways that you employ on your website(s). Learn more about identifying unwanted referrals.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
14455243590301355959
true
Search Help Center
true
true
true
true
true
69256
true
false