GA4, BigQuery and Looker Studio: Build Custom Reports

GA4, BigQuery and Looker Studio: Build Custom Reports: BigQuery & data article cover from AnalyticsLiv

In short

When the GA4 interface can't give you the report you need, export GA4 to BigQuery and build it there. Link GA4 under Admin > Product links > BigQuery links, write a SQL query that unnests the event data into the fields you need, refresh it daily with a scheduled query, and connect that table to Looker Studio.

Contents6 sections

Talk to a specialist

Getting exactly the data you need from the GA4 interface can be hard, and sometimes impossible. With BigQuery as the data source, you can build custom dashboards in a BI tool instead. This guide shows how to use BigQuery as the reporting layer for any dashboard tool, whether it’s Looker Studio (renamed Data Studio in April 2026), Power BI, Tableau or another.

Why use BigQuery for GA4 reporting?

BigQuery is Google Cloud’s serverless, fully managed data warehouse. It processes and analyses very large datasets with SQL, and it handles many queries at once, which makes it a good base for BI and reporting.

Its main advantage as a data source is that you can shape the query to your needs. You can build dimensions and metrics that the GA4 interface doesn’t offer, then send only that table to your dashboard.

Plan first. Decide whether the dashboard needs near real-time data, or data refreshed daily, weekly or at another interval.

How is GA4 data structured in BigQuery?

The GA4 export is built around events and users, with extra information such as device, geography, app and traffic source. Universal Analytics exports had one row per session; in GA4 each row is an event, and each event can have several event parameters and values.

Here is a GA4 dataset queried to show the schema:

GA4 export rows in BigQuery showing nested event parameters

As the example shows, the data is nested. To build a data source for a dashboard, you query this nested data into a table that holds only the dimensions and metrics you need. Depending on the requirement, you may need to unnest fields, and you have to do it carefully so no data is duplicated.

For the full field list, see Google’s GA4 BigQuery export schema.

You need a GA4 property and edit access to it, plus access to the Google Cloud project that will hold the data.

Product links section in GA4 Admin

In GA4 Admin, under ‘Product links’, choose ‘BigQuery links’.

BigQuery links screen in GA4

Follow the steps to choose the Cloud project, data streams and export frequency, and complete the link. More on linking in our guide to GA4 product links.

Wait until the next day (sometimes a little longer), then open your BigQuery project. You will see the raw GA4 data arriving like this:

GA4 export dataset and daily events tables in BigQuery

How do you query the GA4 export for a dashboard?

Write efficient queries

BigQuery runs complex queries fast, but efficient queries still matter. Partitioned tables, clustered columns and denormalised tables speed up queries. Avoid SELECT * and select only the columns you need, which also reduces the data processed.

Choose the dimensions and metrics

For this example Looker Studio dashboard, we need these fields:

DimensionMetric
event_dateitem_viewed
event_nameitem_purchased
item_iditem_revenue_in_usd
item_category
item_brand
channel_grouping_user

Write the SQL

Items arrive nested in the GA4 schema, so this query unnests them:

SELECT
  PARSE_DATE('%Y%m%d', event_date) AS Event_Date,
  event_name AS Event_Name,
  items.item_id AS Item_Id,
  items.item_category AS Item_Category,
  items.item_brand AS Item_Brand,
  CASE
    WHEN traffic_source.source = '(direct)'
      AND traffic_source.medium IN ('(not set)', '(none)') THEN 'Direct'
    WHEN REGEXP_CONTAINS(traffic_source.name, 'cross-network') THEN 'Cross-network'
    WHEN (REGEXP_CONTAINS(traffic_source.source, 'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
        OR REGEXP_CONTAINS(traffic_source.name, '^(.*(([^a-df-z]|^)shop|shopping).*)$'))
      AND REGEXP_CONTAINS(traffic_source.medium, '^(.*cp.*|ppc|paid.*)$') THEN 'Paid Shopping'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
      AND REGEXP_CONTAINS(traffic_source.medium, '^(.*cp.*|ppc|paid.*)$') THEN 'Paid Search'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'badoo|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
      AND REGEXP_CONTAINS(traffic_source.medium, '^(.*cp.*|ppc|paid.*)$') THEN 'Paid Social'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'dailymotion|disneyplus|netflix|youtube|vimeo|twitch')
      AND REGEXP_CONTAINS(traffic_source.medium, '^(.*cp.*|ppc|paid.*)$') THEN 'Paid Video'
    WHEN traffic_source.medium IN ('display', 'banner', 'expandable', 'interstitial', 'cpm') THEN 'Display'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'alibaba|amazon|google shopping|shopify|etsy|ebay|stripe|walmart')
      OR REGEXP_CONTAINS(traffic_source.name, '^(.*(([^a-df-z]|^)shop|shopping).*)$') THEN 'Organic Shopping'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'badoo|facebook|fb|instagram|linkedin|pinterest|tiktok|twitter|whatsapp')
      OR traffic_source.medium IN ('social', 'social-network', 'social-media', 'sm', 'social network', 'social media') THEN 'Organic Social'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'dailymotion|disneyplus|netflix|youtube|vimeo|twitch')
      OR REGEXP_CONTAINS(traffic_source.medium, '^(.*video.*)$') THEN 'Organic Video'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'baidu|bing|duckduckgo|ecosia|google|yahoo|yandex')
      OR traffic_source.medium = 'organic' THEN 'Organic Search'
    WHEN REGEXP_CONTAINS(traffic_source.source, 'email|e-mail|e_mail|e mail')
      OR REGEXP_CONTAINS(traffic_source.medium, 'email|e-mail|e_mail|e mail') THEN 'Email'
    WHEN traffic_source.medium = 'affiliate' THEN 'Affiliates'
    WHEN traffic_source.medium = 'referral' THEN 'Referral'
    WHEN traffic_source.medium = 'audio' THEN 'Audio'
    WHEN traffic_source.medium = 'sms' THEN 'SMS'
    WHEN traffic_source.medium LIKE '%push'
      OR REGEXP_CONTAINS(traffic_source.medium, 'mobile|notification') THEN 'Mobile Push Notifications'
    ELSE 'Unassigned'
  END AS Channel_Grouping_User,
  CASE WHEN event_name = 'view_item' THEN items.quantity ELSE 0 END AS Item_Viewed,
  CASE WHEN event_name = 'purchase' THEN items.quantity ELSE 0 END AS Item_Purchased,
  items.item_revenue_in_usd AS Item_Revenue
FROM
  `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_20210131`,
  UNNEST(items) AS items

Change the table name to your own dataset before you run it.

The query builds fields that GA4 data doesn’t hold as such, for example channel_grouping_user, item_viewed and item_purchased. The traffic_source fields in the export describe how the user was first acquired, which is why the channel group is user-level.

Results:

Query results with item and channel fields in BigQuery

The query is based on examples from ga4bigquery. Whether you need to unnest depends on the fields you use; some queries don’t need it. For more ready-made queries, see our GA4 BigQuery ecommerce queries.

How do you keep the data source up to date?

The GA4 export can send data daily and, if you turn it on, as a streaming export through the day. For a dashboard, it is usually enough to refresh your reporting table once a day with a scheduled query.

Before you schedule: save the query results as a table first, so the scheduled query has a destination table to write to. In this example the table is called ‘Table_1’.

Schedule option above the BigQuery query editor
  1. In the query editor, choose ‘Create new scheduled query’.
  2. Enter the basics, such as the name of the scheduled query and the start time. For a daily refresh, set the repeat frequency to Days.
  3. Select ‘Set a destination table for query results’ and enter the dataset and table name, here ‘Table_1’.
  4. Set the write preference to ‘Overwrite table’ so the table is fully refreshed each time.
  5. Save, then check ‘Scheduled queries’ to follow the progress.
Scheduled query settings with destination table and write preference

Note: with ‘Overwrite table’, the query must cover all dates, not a single day. Use a wildcard table name such as `bigquery-public-data.ga4_obfuscated_sample_ecommerce.events_*`.

How do you connect the table to Looker Studio?

BigQuery has its own query editor, but dashboards are easier to share from a BI tool. Looker Studio, Looker, Power BI and Tableau all connect to BigQuery. In Looker Studio, add a data source, choose the BigQuery connector and select your reporting table, here ‘Table_1’. Then build charts on its dimensions and metrics.

Because the scheduled query refreshes the table every day, the dashboard stays current. If its numbers differ from the GA4 interface, read why GA4 and BigQuery don’t match.

Frequently asked questions.

Ask us your own question

In GA4 Admin, under Product links, choose BigQuery links, then pick the Cloud project, data streams and export frequency. Data usually appears in BigQuery the next day.

The GA4 export stores one row per event, with event parameters and items nested inside. Unnesting turns the fields you need into columns, but do it carefully to avoid duplicates.

Save the query results as a table, then schedule the query daily with Overwrite table as the write preference and a wildcard table name covering all dates.

Yes. Google rebranded Looker Studio as Data Studio in April 2026. It is the same product, so everything in this guide works the same way under the new name.

Need your marketing data in one place?

Talk to our data team about BigQuery pipelines and Looker Studio dashboards.