SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
In this talk, Areej will share her learning process, how SEOs can get acquainted with the world of BigQuery and why SQL is the new and improved Excel. The audience will walk away with a handful of scripts and tips to get their BigQuery journey started!
In this talk, Areej will share her learning process, how SEOs can get acquainted with the world of BigQuery and why SQL is the new and improved Excel. The audience will walk away with a handful of scripts and tips to get their BigQuery journey started!
1.
BigQuery & SQL for SEOs
@areej_abuali linkedin.com/in/areejabuali/
2.
@areej_abuali
HELLO!
I’m here to talk to you about how (5
months ago) I started using BigQuery
& SQL in my day to day job.
2
3.
@areej_abuali
HELLO!
I’m here to talk to you about how (5
months ago) I started using was forced
to start using BigQuery & SQL in my
day to day job.
3
15.
@areej_abuali
What is BigQuery?
15
“BigQuery is an enterprise data warehouse that
stores and queries massive datasets by
enabling super-fast SQL queries using the
processing power of Google’s infrastructure.”
16.
@areej_abuali
What is BigQuery?
16
“BigQuery is an enterprise data warehouse that
stores and queries massive datasets by
enabling super-fast SQL queries using the
processing power of Google’s infrastructure.”
TOO MUCH
GIBBERISH!
17.
@areej_abuali
So what is it then?
17
It’s a thing that will help you analyse
massive datasets quickly and easily
via SQL!
18.
@areej_abuali
Why is it useful?
▸ It’s cloud-based (super scalable)
18
19.
@areej_abuali
Why is it useful?
▸ It’s cloud-based (super scalable)
▸ Unlimited access to historical data
19
20.
@areej_abuali
Why is it useful?
▸ It’s cloud-based (super scalable)
▸ Unlimited access to historical data
▸ It’s pay as you go (1TB = $5)
20
21.
@areej_abuali
Why is it useful?
▸ It’s cloud-based (super scalable)
▸ Unlimited access to historical data
▸ It’s pay as you go (1TB = $5)
▸ Simple interface and setup
21
22.
@areej_abuali
And as for SQL...
▸ It’s a language used for extracting and
analysing data stored in databases
22
23.
@areej_abuali
And as for SQL...
▸ It’s a language used for extracting and
analysing data stored in databases
▸ It’s way faster than Excel because the data
you’re analysing is stored separately
23
24.
@areej_abuali
And as for SQL...
▸ It’s a language used for extracting and
analysing data stored in databases
▸ It’s way faster than Excel because the data
you’re analysing is stored separately
▸ Your code is reusable
24
25.
@areej_abuali
It’s pseudo-codish!
SELECT *
FROM example_table
WHERE example_column = "value"
25
26.
@areej_abuali
What did I need?
26
Data query
(repeatedly)
27.
@areej_abuali
What did I need?
27
Data query
(repeatedly)
Advanced
filtering
28.
@areej_abuali
What did I need?
28
Data query
(repeatedly)
Advanced
filtering
Sort large
datasets
36.
@areej_abuali
GA Sample Dataset
36
https://bigquery.cloud.google.com/table
/bigquery-public-data:google_analytics_
sample.ga_sessions_20170801
https://support.google.com/analytics/answer/7586738
37.
@areej_abuali
GA Sample Dataset
37
https://bigquery.cloud.google.com/table
/bigquery-public-data:google_analytics_
sample.ga_sessions_20170801
https://support.google.com/analytics/answer/7586738
Because if I use
Zoopla data...
38.
@areej_abuali
SQL Query
38
SELECT FROM WHERE
ORDER BY LIMIT
39.
@areej_abuali
SQL Query - Select
39
What columns do you
want to pull?
40.
@areej_abuali
SQL Query - Select
338 columns in total
40
41.
@areej_abuali
SQL Query - Select
▸ SELECT *
▸ SELECT date, visitNumber
▸ SELECT visitNumber as Number
41
42.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
42
SQL Query - Select
43.
@areej_abuali
SQL Query - From
43
Which data source do you
want to pull from?
44.
@areej_abuali
SQL Query - From
44
PROJECT ID DATASET TABLE
45.
@areej_abuali
SQL Query - From
45
PROJECT ID DATASET TABLE
bigquery-public-data.google_analytics_sample.ga_sessions_20170801
46.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
46
SQL Query - From
47.
@areej_abuali
SQL Query - Where
47
What filters do you want
to apply?
48.
@areej_abuali
SQL Query - Where
▸ WHERE channelGrouping = ‘Organic Search’
▸ WHERE channelGrouping in (‘Organic Search’, ‘Direct’)
▸ WHERE channelGrouping = ‘Organic Search’ AND date =
‘20170701’
48
49.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
WHERE channelGrouping = 'Organic Search'
49
SQL Query - Where
50.
@areej_abuali
SQL Query - Order By
50
How do you want to sort
your data?
51.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
WHERE channelGrouping = 'Organic Search'
ORDER BY totals.visits desc
51
SQL Query - Order By
52.
@areej_abuali
SQL Query - Limit
52
How many rows do you
want to return?
53.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
WHERE channelGrouping = 'Organic Search'
ORDER BY Revenue desc
LIMIT 100
53
SQL Query - Limit
54.
@areej_abuali
#standardSQL
SELECT
date as Date,
channelGrouping as Channel,
totals.visits as Visits,
totals.transactionRevenue as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
WHERE channelGrouping = 'Organic Search'
ORDER BY Revenue desc
LIMIT 100
54
Standard vs
Legacy
56.
@areej_abuali
Your typical process...
56
▸ Open GA
▸ Filter data in GA
▸ Export GA data
57.
@areej_abuali
Your typical process...
57
▸ Open GA
▸ Filter data in GA
▸ Export GA data
▸ Open Excel
▸ Clean data
▸ Filter data
▸ Sort data
58.
@areej_abuali
Your typical process...
58
▸ Open GA
▸ Filter data in GA
▸ Export GA data
▸ Open Excel
▸ Clean data
▸ Filter data
▸ Sort data
Cry because everything
breaks and you get the
spinning wheel of death
61.
@areej_abuali
61
But what if I want to
sum up some of my
values?
62.
@areej_abuali
SQL Query - Select
62
SELECT
date as Date,
channelGrouping as Channel,
sum(totals.visits) as Visits,
sum(totals.transactionRevenue) as Revenue
63.
@areej_abuali
SQL Query - Group By
63
SELECT
date as Date,
channelGrouping as Channel,
sum(totals.visits) as Visits,
sum(totals.transactionRevenue) as Revenue
GROUP BY Date, Channel
Non-aggregated
columns should
be in Group By
64.
@areej_abuali
SELECT
date as Date,
channelGrouping as Channel,
sum(totals.visits) as Visits,
sum(totals.transactionRevenue) as Revenue
FROM `bigquery-public-data.google_analytics_sample.ga_sessions_20170801`
WHERE channelGrouping = 'Organic Search'
GROUP BY Date, Channel
ORDER BY Revenue desc
LIMIT 100
64
72.
@areej_abuali
Left Join
72
FROM `Table 1` a
LEFT JOIN `Table 2` b
ON (a.metric = b.metric)
73.
@areej_abuali
Left Join
73
FROM `project-1234.analytics.ga_sessions` a
LEFT JOIN
`project-1234.analytics.ga_transactions` b
ON (a.ga_session_id = b.ga_session_id)
74.
@areej_abuali
SELECT
a.channelGrouping as Channel,
sum(a.totals.visits) as Visits,
sum(b.totals.transactionRevenue) as Revenue
FROM `project-1234.analytics.ga_sessions` a
LEFT JOIN `project-1234.analytics.ga_transactions` b
ON (a.ga_session_id = b.ga_session_id)
WHERE a.channelGrouping = 'Organic Search'
74
75.
@areej_abuali
SQL Query
75
SELECT
FROM
WHERE GROUP BY
JOINORDER BY
76.
@areej_abuali
Covered
▸ SELECT
▸ FROM
▸ WHERE
▸ ORDER BY
▸ GROUP BY
▸ JOIN
▸ LIMIT
76
Not Covered
▸ HAVING
▸ WINDOW
▸ UNION
▸ WITH
80.
@areej_abuali
80
In this talk, we’ve simply
scratched the surface
by analysing Analytics data...
81.
@areej_abuali
There’s so much more to do!
81
Crawl Data
82.
@areej_abuali
There’s so much more to do!
82
Crawl Data Link Data
83.
@areej_abuali
There’s so much more to do!
83
Crawl Data Link Data Log Files
84.
@areej_abuali
84
And there are so many
smart(er) people and resources
to help you do that!
85.
@areej_abuali
85
BristolSEO (Jan 28th)
ReadingSEO (Feb 13th)
Hayden Roche - Technical SEO at Scale
Attend more advanced talks!
https://www.meetup.com/bristol-seo/
https://www.meetup.com/SEO-Meetup-Reading/
@HaydenRoche3
86.
@areej_abuali
86
Read everything Dom writes!
@dom_woodman
▸ How to Use BigQuery for Large-Scale SEO
▸ Guide to Log Analysis with Big Query
https://moz.com/blog/how-to-bigquery-large-scale-seo
https://www.distilled.net/log-file-analysis/
87.
@areej_abuali
Beautiful Dom Slide!
▸ How long does it take for a page to be discovered after
being published?
▸ Which pages have requests from Googlebot?
▸ What are the top non-canonical pages being crawled?
▸ What are the most crawled parameters?
▸ Which directories have the most 404 error codes?
▸ Which pages are crawled with and without parameters?
87
https://www.slideshare.net/DominicWoodman/a-guide-to-log-analysis-with-big-query
88.
@areej_abuali
88
Learn more SQL!
https://www.codecademy.com/catalog/language/sql
89.
@areej_abuali
89
More great resources/courses
▸ Coursera - From Data to Insights with Google Cloud
▸ QwikLabs - BigQuery for Marketing Analysts
▸ Coding is for Losers - Learning BigQuery SQL
▸ OnCrawl - Why SEOs Should Ditch Excel & Learn SQL
▸ Book - Google BigQuery: The Definitive Guide
▸ Google - BigQuery Documentation
▸ Google - BigQuery Cookbook
90.
@areej_abuali
A few final points...
90
Try out every random SQL query
you come across
(and create a library of saved queries)
91.
@areej_abuali
A few final points...
91
Mash up different datasets
together
(it helps answer tons of questions)
92.
@areej_abuali
A few final points...
92
Share cool things you learn with
the rest of us
(and don’t worry about that one idiot on
Twitter who labels it as ‘old news’)
93.
@areej_abuali
A few final points...
93
It’s okay to feel overwhelmed learning
something new
(maybe in 5 months you’ll be giving a talk
about it too!)
94.
@areej_abuali
94
THANKS!
Any Questions?
▸ @areej_abuali
▸ linkedin.com/in/areejabuali