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.

  • Google BigQuery Recipe

    All Related Pages in a Session

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Bounce Rate

    This query was originally posted here:
    Querying Google Analytics Data in BigQuery

  • Google BigQuery Recipe

    Bounce Rate by Day or Hour

    This query was originally posted here:
    Querying Google Analytics Data in BigQuery

  • Google BigQuery Recipe

    Bounce Rate by Landing Page

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Bounce Rates by Traffic Source Medium

    This query was originally posted here:
    Querying Google Analytics Data in BigQuery

  • Google BigQuery Recipe

    Bucket/Bin Data for Histogram

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Compute Bounce Rate

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Compute Multiple Metrics

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Compute Quantiles or Bucketing/Binning

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Create Arbitrary Groupings

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Days Since Last Session with Window Functions

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Days with More than 70 Sessions

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Different Windowing Functions

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Extract Dimensions from Other Fields

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Finding Data Where A Condition Is Met

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    First Example Query

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Flattening a Repeated Field

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Flattening with Multiple Repeated Fields

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Grouping Fields

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Hits by Client ID

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Joining with Refund Data

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Landing Page for Visit(or)s

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Logins After a Product View

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Mediums with the Most Sessions per Hour

    This query was originally posted here:
    Querying Google Analytics Data in BigQuery

  • Google BigQuery Recipe

    Metrics for Custom Dimension Values

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Number of Organic Sessions

    This query was originally posted here:
    Querying Google Analytics Data in BigQuery

  • Google BigQuery Recipe

    Number of Sessions Per Day

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Ordering by Fields

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    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

  • Google BigQuery Recipe

    Percent of New Sessions with Mediums

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Pivoting Custom Dimensions

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Segmenting by Custom Dimensions

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Selecting a Date Range from Tables

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Session ID

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Sessions with Transactions

    This query was originally posted here:
    What’s Missing in the Google Analytics BigQuery Export Schema?

  • Google BigQuery Recipe

    Sessions with Transactions

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Simple Windowing Function

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Simple Windowing Function With Sorted Order

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Summing Total Hits

    This query was originally posted here:
    Practical Google Analytics and Google Tag Manager for Developers

  • Google BigQuery Recipe

    Time on Page with UDF (User Defined Functions)

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Time on Page with Windowing Function

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Windowing Function With Aggregate Function

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

  • Google BigQuery Recipe

    Windowing Functions: Partition By

    This query was originally posted here:
    Self-Joins, Windowing, and User Defined Functions in BigQuery

Contact Us.

Follow Us

1.877.220.LUNA

1.412.381.5500

getinfo@lunametrics.com

Questions?
We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203

THE STUDIO [map]

4115 N. Ravenswood
Suite 101
Chicago, IL 60613

THE LODGE [map]

2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187