Get more from Analytics 360 with BigQuery and the Google Cloud Platform

57
javier ramirez @supercoco9 Get more from Analytics with Google BigQuery and the Google Cloud Platform

Transcript of Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Page 1: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

javier ramirez@supercoco9

Get more from Analytics with Google BigQuery and the Google Cloud Platform

Page 2: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

founder of https://datawaki.comhttps://teowaki.com

We help companies on big data,google analytics 360, and cloud.

We can advise, train, optimise,code, or deploy solutions.

Page 3: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Script template for House MD:

* Patient gets in (dying)* Dr launches hypothesis* They take metrics (using

awesome technology)* New hypothesis aftertheir insights

* Conversion! She'll live

Page 4: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

A doctor with a basic hypothesiswithout the technology to seebeyond the obvious

Page 5: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

We needbetter insights

We already use Google

Analytics

Page 6: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Isn't Google Analytics good enough?

Page 7: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Google Analytics is great but...

Even premium accounts get sampled reports when there are too many data (and not all the reports can be unsampled).

Page 8: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 9: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 10: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Google Analytics is great but...

If you need to manage advanced segments, and if you want to combine segments, it can get tricky.

And even if now you can get down to user level, it is really designed to show you aggregated data.

Page 11: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 12: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 13: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Google Analytics is great but...

It's not easy to cross data in Analytics with data from other sources (CRM, invoicing system...)

You can use Data Import, but there are many constraints to what you can do with it

Page 14: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Google Analytics is great but...

Good for knowing what's happening in your application, but difficult for:

* business intelligence/big data (data mining, finding patterns...)

* machine learning (classify information, predict future trends...)

Page 15: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

image from http://www.asphaltandrubber.com/

What if Googlegave me accessto my whole

raw data

Page 16: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

bigdata is cool but...

expensive cluster

hard to set up and monitor

not interactive enough

Page 17: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

What if I could...

..query billions of rows in seconds..

..using a SQL-like web interface..

..on a fully managed cloud..

..paying only when I use it?

Page 18: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Designed to run analytics over huge volumes of raw data, and to integrate with other data sources

https://cloud.google.com/products/bigquery/

Google BigQuery

Page 19: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Google Analytics 360 users get free daily exports from GA to BigQuery.

Google BigQuery + GA 360

Page 20: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

All your raw data.Unsampled.Use it however you want.

BOOM!

Google BigQuery + GA 360

Page 21: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

integrating with external data sources

* Export from any source* Import into BigQuery

Page 22: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

happier than a baby panda

on a rocking horse

Page 23: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

data schema

Page 24: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

it's just SQL

Page 25: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT trafficSource.source, SUM( totals.transactions ) AS total_transactionsFROM [123456789.ga_sessions_20161001]GROUP BY trafficSource.sourceORDER BY total_transactions;

basic queries (metric/dimension)

SELECT device.deviceCategory, SUM ( totals.pageviews ) AS total_pageviewsFROM [123456789.ga_sessions_20161001]GROUP BY device.deviceCategoryORDER BY total_pageviews;

Page 26: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT IF(DOMAIN(trafficSource.source) is null,

'n/a',DOMAIN(trafficSource.source))

AS normalized_source, SUM ( totals.transactions ) AS total_transactions

FROM [123456789.ga_sessions_20161001]GROUP BY normalized_sourceORDER BY total_transactions;

basic queries with a twist

Page 27: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT ( SUM(total_transactionrevenue_per_user) / SUM(total_visits_per_user) ) AS avg_revenue_by_user_per_visitFROM ( SELECT SUM(totals.visits) AS total_visits_per_user, SUM( totals.transactionRevenue ) AS total_transactionrevenue_per_user, visitorId FROM [123456789.ga_sessions_20161001] WHERE totals.visits>0 AND totals.transactions>=1 AND totals.transactionRevenue IS NOT NULL GROUP BY visitorId ) ;

Average amount spent per visit

Page 28: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

2 segments, combined

Page 29: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 30: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 31: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 32: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT fullvisitorID, visitID, visitNumber, hits.page.pagePathFROM [123456789.ga_sessions_20161001]where hits.type='PAGE'order by fullvisitorID, visitID, hits.hitnumber asc

Identify user path/user actions

Page 33: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

individual users' data is awesome

Cross CRM data with individual users actions to seehow your response to incidents affect your users.

Use the “frequently bought together” query and findusers who didn't buy the related products. Send ane-mail campaign with an offer for those products.

Page 34: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT hits.item.productName AS other_purchased_products, COUNT(hits.item.productName) AS quantityFROM [123456789.ga_sessions_20161001]WHERE fullVisitorId IN ( SELECT fullVisitorId FROM [123456789.ga_sessions_20161001] WHERE hits.item.productName CONTAINS 'Light Helmet' AND totals.transactions>=1 GROUP BY fullVisitorId ) AND hits.item.productName IS NOT NULL AND hits.item.productName !='Light Helmet'GROUP BY other_purchased_productsORDER BY quantity DESC;

Users who bought product A,also bought product B

* example query from the BigQuery Cookbook for Google Analytics 360 https://support.google.com/analytics/answer/4419694?hl=en&ref_topic=3416089

Page 35: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

SELECT prod_name, count(*) as transactions FROM (SELECT fullVisitorId, min(date) AS date, visitId, hits.item.productName as prod_nameFROM (SELECT fullVisitorId, date, visitId, totals.transactions, hits.item.productName FROM (TABLE_DATE_RANGE([dataset.ga_sessions_], TIMESTAMP('2014-06-01'), TIMESTAMP('2014-06-14'))) )WHERE fullVisitorId IN (SELECT fullVisitorIdFROM (TABLE_DATE_RANGE([dataset.ga_sessions_], TIMESTAMP('2014-06-01'), TIMESTAMP('2014-06-14'))) GROUP BY fullVisitorId HAVING SUM(totals.transactions) > 1 )AND hits.item.productName IS NOT NULLGROUP BY fullVisitorId, visitId, prod_name ORDER BY fullVisitorId DESC)GROUP BY prod_name ORDER BY transactions DESC;

* example query from the lunametrics blog. Check them out for more awesomeness

Products that are purchasedand lead to other products being purchased

Page 36: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Machinelearni...

Hipster!

Page 37: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

ML with Google Dataproc

Page 38: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 39: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 40: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

ML with Google ML (Tensorflow)

Page 41: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

* prediction example from the Google cloud, big data, and machine learning blog https://cloud.google.com/blog/big-data/2016/05/

ML with Google ML (Tensorflow)

Page 42: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

* prediction example from the Google cloud, big data, and machine learning blog https://cloud.google.com/blog/big-data/2016/05/

Page 43: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

* prediction example from the Google cloud, big data, and machine learning blog https://cloud.google.com/blog/big-data/2016/05/

Page 44: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

* prediction example from the Google cloud, big data, and machine learning blog https://cloud.google.com/blog/big-data/2016/05/

Page 45: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 46: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 47: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 48: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 49: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 50: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

try it out at http://bit.ly/datastudio(login with a bigquery-enabled account required)

Page 51: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 52: Get more from Analytics 360 with BigQuery and the Google Cloud Platform
Page 53: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

GA 360 users get a monthly $500 credit to use BigQueryStorage costs $0.02 per GB/month ($0.01 for data older than 90 days)

Querying costs $5 per TB. With the 1st TB free every month

For power-users BigQuery just released a query flat-rate

Page 54: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

What if I don't havea GA 360 account?

Page 55: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

just send your own data

define a data structure that fits your needs (or replicate the one GA provides)

use a JS snippet to send data to your server/BigQuery at the same time you send it to GA

Page 56: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Ready to Ready to dive into dive into your GA your GA data?data?

Page 57: Get more from Analytics 360 with BigQuery and the Google Cloud Platform

Need help with your data?https://teowaki.com

Thanks! Javier Ramirez@supercoco9