LunaMetrics Google BigQuery Recipes
Here's our collection of easy-to-copy queries designed for Google BigQuery. Whether you're just starting to use Google BigQuery, recreating common Google Analytics metrics within the BigQuery interface, or attempting more advanced data manipulation - we've got you covered.
-
All Related Pages in a Session
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Bounce Rate
This query was originally posted here:
Querying Google Analytics Data in BigQuery -
Bounce Rate by Day or Hour
This query was originally posted here:
Querying Google Analytics Data in BigQuery -
Bounce Rate by Landing Page
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Bounce Rates by Traffic Source Medium
This query was originally posted here:
Querying Google Analytics Data in BigQuery -
Bucket/Bin Data for Histogram
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Compute Bounce Rate
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Compute Multiple Metrics
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Compute Quantiles or Bucketing/Binning
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Create Arbitrary Groupings
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Days Since Last Session with Window Functions
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Days with More than 70 Sessions
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Different Windowing Functions
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Extract Dimensions from Other Fields
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Finding Data Where A Condition Is Met
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
First Example Query
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Flattening a Repeated Field
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Flattening with Multiple Repeated Fields
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Grouping Fields
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Hits by Client ID
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Joining with Refund Data
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Landing Page for Visit(or)s
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Logins After a Product View
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Mediums with the Most Sessions per Hour
This query was originally posted here:
Querying Google Analytics Data in BigQuery -
Metrics for Custom Dimension Values
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Number of Organic Sessions
This query was originally posted here:
Querying Google Analytics Data in BigQuery -
Number of Sessions Per Day
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Ordering by Fields
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
People Who Viewed One Page Viewed Which Other Pages How Many times?
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Percent of New Sessions with Mediums
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Pivoting Custom Dimensions
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Segmenting by Custom Dimensions
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Selecting a Date Range from Tables
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Session ID
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Sessions with Transactions
This query was originally posted here:
What’s Missing in the Google Analytics BigQuery Export Schema? -
Sessions with Transactions
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Simple Windowing Function
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Simple Windowing Function With Sorted Order
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Summing Total Hits
This query was originally posted here:
Practical Google Analytics and Google Tag Manager for Developers -
Time on Page with UDF (User Defined Functions)
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Time on Page with Windowing Function
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Windowing Function With Aggregate Function
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery -
Windowing Functions: Partition By
This query was originally posted here:
Self-Joins, Windowing, and User Defined Functions in BigQuery