0% found this document useful (0 votes)
33 views

Templates of SQL Queries To Google Bigquery That Will Take Your Reports To Another Level

This document discusses how SQL queries in Google BigQuery can help overcome limitations of standard Google Analytics reports and provide more comprehensive insights. It provides templates for SQL queries that can analyze user behavior across any dimensions, calculate key metrics and averages for user actions, group users by product pages visited, and identify users who purchased specific products. The templates allow pulling all relevant metrics and dimensions together in a single report, unlike standard Google Analytics reports.

Uploaded by

Kunal Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Templates of SQL Queries To Google Bigquery That Will Take Your Reports To Another Level

This document discusses how SQL queries in Google BigQuery can help overcome limitations of standard Google Analytics reports and provide more comprehensive insights. It provides templates for SQL queries that can analyze user behavior across any dimensions, calculate key metrics and averages for user actions, group users by product pages visited, and identify users who purchased specific products. The templates allow pulling all relevant metrics and dimensions together in a single report, unlike standard Google Analytics reports.

Uploaded by

Kunal Arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Templates of SQL Queries to Google

BigQuery That Will Take Your Reports to


Another Level
Learn about the common challenges in creating reports Google
Analytics, and how you can overcome them by using Google
BigQuery

In this post, we’re sharing report templates that you can build with SQL
queries to Google BigQuery data.

First, you’ll find out about what you can calculate with the standard export
from GA360 to GBQ.

Next, you’ll discover what unique metrics can be added to the standard
Google Analytics ones, with the help of OWOX BI Pipeline.

Reports based on the standard export from Google Analytics


360 to BigQuery

Google Analytics reports are user-friendly and convenient, though you may
face sampling, data aggregation, and other limitations. Heads up! There’s a
way out: using the standard data export to Google BigQuery to circumvent
restrictions and build more comprehensive reports via SQL requests.

1. User behavior across any dimension

Say you’ve implemented new metrics or updated the existing ones on your
website, to measure KPIs important to your business. You can use the
report on hit number changes on your website to see if the data is sent
correctly and to react timely to any analytics errors. You’ll need the
following dimensions for this report type:

 device.deviceCategory.

 device.browser.

 hits.type.

 eventCategory.

 eventAction.

 Content Grouping.

A regular Google Analytics report wouldn’t provide you with all the
aforementioned information, as it allows to simultaneously choose 2
dimensions only, while a custom report suggests a little more — 5
dimensions. SQL queries don’t have such restrictions, engaging you to pull
all metrics and dimensions you’d like in a report.

The SQL query template we’re providing in the PDF file will help you find
out about how sessions, users, and hits are distributed among browsers,
devices, and hit types. If needed, you can add any more dimensions to the
query. For instance:

 device.operatingSystem.

 device.mobileDeviceInfo.

 device.language.
 geoNetwork.region.

By adding these dimensions, you’ll get the following table:

Image courtesy of the author

You can also import the information from your CRM or ERP systems to
Google BigQuery. Thus, you’ll be able to analyze user behavior across any
metrics required: product catalog, margin, product category, user
description, order completion, etc. For example, you send a query to get
data on transactions, then combine them with the paid off orders from
CRM, and calculate the percentage of online completed orders. This will
help you understand if there are any issues on the way from placing an
order to payment or delivery.

2. Statistics on key user actions

If you want to build up user segments and set up personalized newsletters,


you’ll need info on the online user behavior. The more details, the more
options for segmentation. Google Analytics won’t provide you with a
report on all user actions like pageview, event, social, timing, as well as
Enhanced Ecommerce events (click, detail, add, remove, checkout,
purchase, refund), across hit types. You can’t also view the average,
maximum or minimum values across hit types for a certain user. However,
all of that information will be available thanks to one of the SQL queries
you’ll find in the PDF file attached to this post.

The aforementioned query will also help you calculate the following
average, maximum and minimum values for each user:

 Page views according to a certain search query.

 Page views per visit.

 Number of times adding products to cart.

 Number of times removing products from cart.

 Number of products added to cart.

 Number of products removed from cart.

 Total price of products added to cart.

 Total price of products removed from cart.

Using the very same SQL query, you can also calculate these values for
each session:

 Page views according to a certain search query.

 Page views per session.

 Number of times adding to / removing products from cart.

 Number of products added to / removed from cart.


 Total price of products added to / removed from cart.

With such information at hand, you can predict repeated purchases and
micro conversions.

3. Selecting users that visited certain product pages

To refine your sales funnel, you need to give a proper credit to what users
do on your website before making a purchase. «User Explorer» report in
GA will provide you with the info on all types of user actions (pageview,
event, social, timing). However, it may be complicated and time
consuming, as you’ll get to see this kind of statistics per a single user only,
applying advanced segments and product ID filters for that purpose.

However, building up a report, based on the standard export from GA360


to Google BigQuery, will provide you with the data about all user actions
on your website, tracked via the GA code. For example, the SQL query
we’ve talked about earlier, will help you group users that viewed some
product pages. Thus, you’ll get to remind the users, who left the items in
cart without paying, of the products they were interested in, as well as
recommend other products, and even develop customer profiling.

4. Actions of users who bought a certain product

All the aforementioned in the previous paragraph applies to this report as


well. Using the SQL query from our PDF file, you’ll get to build a report
that includes names of users who bought a definite item. These names will
allow you to offer users similar products or accessories to the products
already bought.

You might also like