Device, app, web, stream and platform dimensions & metrics (GA4)
How to query the most important device, app and web dimensions and metrics from the GA4 BigQuery export, like device category, mobile brand, browser, operation system, language and hostname.
A lot of Google Analytics 4 dimensions and metrics can be derived straight from the tables without performing calculations on the data. With the help of unnest
and parse
for dates or timestamps we can do the trick.
Other dimensions and metrics that you might need are a bit harder to access. You will have to (re)calculate them, which can require some serious SQL-skills.
While designing the course Query GA4 Data In Google BigQuery I've learned a lot about best practices to calculate dimensions and metrics. To share this knowledge with you I will provide a combined query for default dimensions and metrics, and a single example query for every non-default dimension or metric.
As always, drop a line in the comments if you have any questions, feedback or suggestions related to this article.
Default device dimensions
- device.category
- device.mobile_brand_name
- device.mobile_model_name
- device.mobile_marketing_name
- device.mobile_os_hardware_model
- device.operating_system
- device.operating_system_version
- device.vendor_id
- device.advertising_id
- device.language
- device.is_limited_ad_tracking
- device.time_zone_offset_seconds
- device.browser
- device.browser_version
Default app dimensions
- app_info.id
- app_info.version
- app_info.install_store
- app_info.firebase_app_id
- app_info.install_source
Default web dimensions
- device.web_info.browser
- device.web_info.browser_version
- device.web_info.hostname
Default stream & platform dimensions
- stream_id
- platform
-- comments
in the example query below for names and definitions and copy the part you need from the select
clause. Make sure that you also add any additional conditions (i.e. with
, from
, where
, group by
, having
and order by
) that are necessary to calculate the results correctly. E.g, the query below is ungrouped, so every row corresponds to an event and may contain duplicate rows.