How do I use BigQuery with GA4 for advanced analysis?

Applies to: Google Analytics 4 (GA4), Google BigQuery
Last updated: May 2025


Problem

You need access to raw GA4 data for advanced queries, custom reports, or large-scale analysis beyond what GA4’s UI and Explorations can provide.


Solution

GA4 supports native integration with Google BigQuery, allowing you to export all event-level data into a warehouse environment. From there, you can write SQL queries, build dashboards, or join with other datasets.


Step-by-Step Guide

Step 1: Set Up a Google Cloud Project

  1. Go to https://console.cloud.google.com
  2. Create or select a Google Cloud project
  3. Enable BigQuery API under APIs & Services
  4. Ensure billing is enabled for the project

Step 2: Link GA4 to BigQuery

  1. In https://analytics.google.com, go to your GA4 property
  2. Click Admin > BigQuery Links
  3. Click Link
  4. Select your Cloud project
  5. Choose:
    • Daily export (once per day)
    • Streaming export (export data in near real-time; optional, adds cost)
  6. Review and submit

GA4 will start exporting your data to a dataset named analytics_<property_id> in BigQuery.


Step 3: Explore GA4 Data in BigQuery

Once data starts flowing, use the BigQuery console to run SQL queries.

Example: Top pages by user count

SELECT
event_params.value.string_value AS page_path,
COUNT(DISTINCT user_pseudo_id) AS users
FROM
`your_project.analytics_123456789.events_*`,
UNNEST(event_params) AS event_params
WHERE
event_name = "page_view"
AND event_params.key = "page_location"
GROUP BY page_path
ORDER BY users DESC
LIMIT 10

You can also analyze:

  • User journeys
  • Funnel drop-offs
  • Custom conversions
  • Event sequencing
  • Join with CRM or ad data

Step 4: Visualize BigQuery Data (Optional)

You can connect BigQuery to tools like:

  • Looker Studio
  • Power BI
  • Tableau
  • Google Sheets

Use them to create custom dashboards or reports on top of your raw GA4 data.


Notes

  • GA4’s BigQuery export includes every user interaction (event-level data)
  • Data is structured by:
    • events_* tables (daily)
    • Fields like event_name, user_pseudo_id, event_params, user_properties
  • BigQuery costs are based on storage and query size—be cautious with large datasets