Member-only story

How to query and calculate Google Universal Analytics data in BigQuery

A Standard SQL cookbook with examples queries

Johan van de Werken
Towards Data Science
16 min readJul 21, 2019

--

When I first started querying Google Analytics data in BigQuery, I had a hard time interpreting the ‘raw’ hit-level data hiding in the ga_sessions_ export tables. Because I could not find a noob-proof guide on how to calculate Google Analytics metrics in BigQuery, I decided to write one myself. I provide lots of example queries so you don’t have to reinvent the wheel and hopefully you can save yourself some valuable time.

Update: do you enjoy this article? Then you’ll also like my new website GA4BigQuery.com: a digital guide with tips, ideas, example queries and tutorials on how to query Google Analytics data in BigQuery & rock your digital marketing analytics.

I’ve migrated most example queries from this article to the new website, as it is easier to maintain all content in one place. This article will stay online to refer you to the right place.

I also published an article about querying Google Analytics 4 (previously App + Web) event data in BigQuery. This content will be migrated to GA4BigQuery.com too.

Image by Berber Bijlsma

Table of contents

Introduction to Google Analytics data in BigQuery
Multiple tables
User
Session
–…

--

--

Towards Data Science
Towards Data Science

Published in Towards Data Science

Your home for data science and AI. The world’s leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.

Responses (20)