GA4 BigQuery Export: Complete Setup Guide
How to set up GA4 BigQuery export for advanced analytics. Covers setup, costs, common queries, and when you need it.
GA4's BigQuery export gives you raw, hit-level analytics data that you can query with SQL. It's the most powerful analytics capability Google offers — and it's free.
Why BigQuery Export?
GA4's interface has limitations: - Data sampling kicks in on large date ranges - Custom reports can't answer every question - Data retention limits historical analysis - API quotas restrict automated reporting
BigQuery solves all of these: - Zero sampling — query every single event - Unlimited retention — data stays forever - SQL access — join with CRM, ad spend, or any other data - Machine learning — build predictive models on your analytics data
Setup Steps
1. Create a Google Cloud Project
If you don't have one, go to console.cloud.google.com and create a new project. BigQuery is included for free.
2. Link GA4 to BigQuery
- GA4 Admin → Product Links → BigQuery Links
- Choose your Google Cloud project
- Select "Daily" export (or "Streaming" for real-time, but this has costs)
- Choose your export region
- Enable
Data starts flowing within 24 hours.
3. Understand the Schema
The BigQuery export creates tables named events_YYYYMMDD. Each row is one event with:
- event_name — The event name
- event_params — Array of key-value parameters
- user_properties — Array of user property key-values
- device — Device info (category, browser, OS)
- geo — Geographic data (country, city)
- traffic_source — First-touch attribution
4. Essential Queries
Total events by name (last 7 days):
```sql
SELECT event_name, COUNT(*) as count
FROM `project.analytics_12345.events_*`
WHERE _TABLE_SUFFIX BETWEEN
FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY))
AND FORMAT_DATE('%Y%m%d', CURRENT_DATE())
GROUP BY event_name
ORDER BY count DESC
```
Purchase revenue by source:
```sql
SELECT traffic_source.source,
COUNT(*) as purchases,
SUM(ecommerce.purchase_revenue) as revenue
FROM `project.analytics_12345.events_*`
WHERE event_name = 'purchase'
GROUP BY 1 ORDER BY revenue DESC
```
Costs
- Daily export: Free (yes, really)
- Streaming export: ~$0.05 per 200MB streamed
- Query costs: First 1TB/month free, then $5/TB
- Storage: First 10GB/month free, then $0.02/GB
For most sites, the total cost is under $10/month.
When Do You Need BigQuery?
- >100K sessions/month — GA4 starts sampling your reports
- Multi-platform analytics — Join GA4 with CRM, ad platforms, or revenue data
- Custom attribution models — Build your own beyond GA4's options
- ML/AI models — Predict churn, LTV, or conversion probability
Ensure your GA4 is ready for BigQuery export — run a free audit →
Check your GA4 implementation
Run a free AI-powered audit to see how your tracking stacks up.
Start Free Audit