<@U07FJ89LFFB> do you have an example of fact tabl...
# ask-ai
w
@brash-pillow-71627 do you have an example of fact table for GA4?
b
A message from kapa.ai
Yes, here is an example of a Fact Table for Google Analytics 4 (GA4) in GrowthBook. This example uses the raw events table exported from GA4 to BigQuery. The table includes key columns such as timestamp, user identifiers, event type, and context fields:
Copy code
sql SELECT     -- Timestamp     TIMESTAMP_MICROS(event_timestamp) as timestamp,     -- Ids     user_id,     user_pseudo_id as anonymous_id,     -- Event type     event_name,     -- Context     event_value, -- e.g. the page view path     geo.country,     device.category as device_category   FROM     `events_*`   WHERE     -- Daily tables     ((_TABLE_SUFFIX BETWEEN '{{date startDateISO "yyyyMMdd"}}' AND '{{date endDateISO "yyyyMMdd"}}')     -- Realtime streaming intraday table     OR (_TABLE_SUFFIX BETWEEN 'intraday_{{date startDateISO "yyyyMMdd"}}' AND 'intraday_{{date endDateISO "yyyyMMdd"}}'))
This structure allows you to filter and create metrics based on the
event_name
column, which is a common pattern for GA4 data in GrowthBook. You can further customize the columns and filters based on your specific needs and the events you want to track. GrowthBook also supports auto-generating fact tables for GA4 data sources, which will include relevant columns like user IDs, timestamp, device, browser, and more, to help you get started quickly [Metric Examples and Use Cases](https://docs.growthbook.io/app/metrics/examples) [Auto fact tables and metrics for GA4/BigQuery](https://github.com/growthbook/growthbook/pull/3062).