For GA360 clients, Google automatically sends Google Analytics data to BigQuery after a quick setup is done in Google Analytics and Console. Data is stored each day in a separate table coming from a listed Google Analytics view.
But how do you make your Google Analytics account more useful with BigQuery? The answer: get to know how to query Google Analytics data in BigQuery to answer basic business questions.
Here are ten basic Google Analytics queries every marketer should know and how to use them.
Number of hits in a day
Number of sessions grouped by medium
For a complete unique ID in BigQuery you should use fullVisitorId and VisitId. Underscore and a blank area both work between characters. For using CONCAT function you will have to convert visitID field from numeric to string.
To sort by a specific field use the ORDER BY clause and place it after FROM, WHERE or GROUP BY. If the order type is not specified as ‘ASC’ for ascending or ‘DESC’ for descending after the field name in the ORDER BY clause then the field will be sorted in ascending order by default.
To get to landing page data of the users in the WHERE clause set the hits.hitnumber = 1.
Set the totals.transactions field to greater than 0. Totals.transactions fields passes the total number of ecommerce transaction number in a session. Therefore, totals.transactions field will be greater than 0 for all the valid transactions.
If you want to understand how interactions or hit types are impacting the user behavior use the following query. Different types of hits are “PAGE,” “TRANSACTION,” “ITEM,” “EVENT,” “SOCIAL,” “APPVIEW,” “EXCEPTION.” You can add other fields to the select statement to better understand the user behavior.
Calculate the bounce rate percentage by date and hour. To round of the bounce rate, use the ROUND function.
Google sends GA data to BigQuery in a daily date table format. Query multiple tables together using table decorators. In the example below we are querying data for a month by specifying the timestamp in the TABLE_DATE_RANGE function.
Remember to always format dates in YYYY-MM-DD format in BigQuery.
To query multiple repeated fields, you can use the FLATTEN function.
By using these 10 queries you can answer day to day business questions and use BigQuery more effectively. To learn more about BigQuery and how it can help improve your brand’s analytics contact us and speak to one of our BigQuery certified experts.