The traffic source fields within the GA4 BigQuery export provide information on the acquisition source for each event, and the initial traffic source that led to the user’s first interaction with your platform.
The collection of data within these fields can depend on the configuration of various product integrations within Google Analytics, as well as the inclusion of UTM parameters in the links leading to your site or app.
Note, this information is collected in 2 different records:
- collected_traffic_source – contains the information collected with the event
- traffic_source – contains the information collected on the user’s first visit
Field Name | Data Type | Description | Example Values |
---|---|---|---|
collected_traffic_source.manual_campaign_id | STRING | Campaign id value (utm_id) collected with the event | 1, 2, A, B, etc. |
collected_traffic_source.manual_campaign_name | STRING | Campaign name value (utm_campaign) collected with the event | (organic) (referral) |
collected_traffic_source.manual_source | STRING | Source value (utm_source) collected with the event | google bing m.facebook.com |
collected_traffic_source.manual_medium | STRING | Medium value (utm_medium) collected with the event | organic paid search |
collected_traffic_source.manual_term | STRING | Keyword/term (utm_term) collected with the event | A value unique to your business |
collected_traffic_source.manual_content | STRING | Content value (utm_content) collected with the event | A value unique to your business |
collected_traffic_source.gclid | STRING | The Google click identifier collected with the event | Cj0KCQjw2… |
collected_traffic_source.dclid | STRING | The Google Marketing Platform (GMP) identifier collected with the event | CInBiqX13v… |
collected_traffic_source.srsltid | STRING | The Google Merchant Center identifier collected with the event | EAIaIQobC… |
traffic_source.name | STRING | Campaign name value (utm_campaign) captured on the user’s first visit | (organic) (direct) |
traffic_source.medium | STRING | Medium value (utm_medium) captured on the user’s first visit | organic paid search |
traffic_source.source | STRING | Source value (utm_source) captured on the user’s first visit | google bing (direct) |
Sample traffic source fields query
Select the traffic source fields you need from the below query.
SELECT
collected_traffic_source.manual_campaign_id,
collected_traffic_source.manual_campaign_name,
collected_traffic_source.manual_source,
collected_traffic_source.manual_medium,
collected_traffic_source.manual_term,
collected_traffic_source.manual_content,
collected_traffic_source.gclid,
collected_traffic_source.dclid,
collected_traffic_source.srsltid,
traffic_source.name,
traffic_source.medium,
traffic_source.source
FROM `<project>.<dataset>.<table>`
Important Note: Make sure you replace the placeholders within the WHERE clause with the specific values for the table you are working with. For example, if you want to extract data for January 31st 2021 from the e-commerce sample dataset, use the following values:
- <project> should be replaced with bigquery-public-data
- <dataset> should be replaced with ga4_obfuscated_sample_ecommerce
- <table> should be replaced with events_20210131
Ensure that you substitute these placeholders with your actual project, dataset, and table names when executing the queries.
For details and examples of other fields & dimensions see: