Skip to main content

GA4 | dimensions & metrics

Privacy info (consent mode) dimensions & metrics (GA4)

How to query privacy info (consent mode) dimensions from the GA4 BigQuery export, like privacy_info.analytics_storage and privacy_info.ads_storage.

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.

💡
Read how to effectively query the GA4 BigQuery export data in two specific consent mode implementation scenarios: basic and advanced consent mode.

Default privacy_info dimensions

  • privacy_info.analytics_storage
  • privacy_info.ads_storage
  • privacy_info.uses_transient_token
💡
If you only need one default dimension or metric, look at the -- 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.
select
  privacy_info.analytics_storage,
  privacy_info.ads_storage,
  privacy_info.uses_transient_token
from
  -- change this to your google analytics 4 export location in bigquery
  `ga4bigquery.analytics_250794857.events_*`
where
  -- define static and/or dynamic start and end date
  _table_suffix between '20240701'
  and format_date('%Y%m%d',date_sub(current_date(), interval 1 day))