Hello!
When checking the sessions result in BQ vs GA4 for source, medium, and default channel grouping, the sessions for source = (not set) are not visible in BQ. Why is that happening? How can I correct it?
This is the formula I used to get session results by source, medium, and default_channel_grouping
SELECT
CASE
WHEN traffic_source.source IS NULL
OR traffic_source.source = ‘’ THEN ‘(not set)’
ELSE traffic_source.source
END as source,
CASE
WHEN traffic_source.medium IS NULL
OR traffic_source.medium = ‘’ THEN ‘(not set)’
ELSE traffic_source.medium
END as medium,
CASE
WHEN session_traffic_source_last_click.cross_channel_campaign.default_channel_group IS NULL
OR session_traffic_source_last_click.cross_channel_campaign.default_channel_group = ‘’ THEN ‘(not set)’
ELSE session_traffic_source_last_click.cross_channel_campaign.default_channel_group
END as default_channel_grouping,
COUNT(*) as session_count
FROM YOUR_PROJECT_ID].[YOUR_DATASET_ID].[YOUR_EVENT_TABLE_ID]
WHERE event_name = ‘session_start’
GROUP BY 1, 2, 3
ORDER BY session_count DESC;
Hi @ioana_p ,
Welcome to Google Cloud Community!
As stated in this documentation, GA4 uses “(not set)” when dimension information is missing. This can also occur due to factors like improper tagging, or attribution issues. In BigQuery, since you’re working with raw data, you need to explicitly handle NULL or empty values.
Additionally, I came across a thread where someone asked about dealing with discrepancies in session queries, and it was answered by one of our expert staff. Take a look at it, as I believe it will be very helpful for your case.
For a deeper investigation, you can reach out to Google Cloud Support. When reaching out, include detailed information and relevant screenshots of the errors you’ve encountered. This will assist them in diagnosing and resolving your issue more efficiently.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
The thread you linked to contains an error:
traffic_source.source is not the session source - it contains the user acquisition source.
(so the first session source of this user)
The solution to OP is simple:
Query `
session_traffic_source_last_click.cross_channel_campaign.source` and you will see the (not set) values in there