SlideShare a Scribd company logo
1 of 74
Download to read offline
Building Funnels
with Google BigQuery
@devxoul
Human
100 view
200 click
300 view
400 click
500 click
600 buy
100 view
200 click
300 view
400 click
500 click
600 buy
100 view
200 click
300 view
400 click
500 click
600 buy
100 view
200 click
300 view
400 click
500 click
600 buy
view 2
click 2
buy 1
Computer
time view click buy
100 100
200 200
300 300
400 400
500 500
600 600
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
origin next next
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
<
origin next next
time view click buy
100 100
200 100 200
300 300
400 300 400
500 300 500
600 300 500 600
origin next next
time view click buy
100 100
200 100 200
300 300
400 300 400
500 300 500
600 300 500 600
origin next next
time view click buy
100 100
200 100 100
300 300
400 300 300
500 300 300
600 300 300 300
origin next next
time view click buy
100 100
200 100 100
300 300
400 300 300
500 300 300
600 300 300 300
time view click buy
100 100
200 100 100
300 300
400 300 300
500 300 300
600 300 300 300
100
300
100
300
300
view 2
click 2
buy 1
Query
100 view
200 click
300 view
400 click
500 click
600 buy
Before (1)
time view click buy
100 100
200 200
300 300
400 400
500 500
600 600
After (1)
Query (1)
#standardSQL
SELECT
time,
(CASE event WHEN "view" THEN time END) AS view,
(CASE event WHEN "click" THEN time END) AS click,
(CASE event WHEN "buy" THEN time END)AS buy
FROM
events
time view click buy
100 100
200 200
300 300
400 400
500 500
600 600
Before (2)
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
After (2)
#standardSQL
SELECT
LAST_VALUE(view) OVER (ORDER BY time) AS view,
LAST_VALUE(click) OVER (ORDER BY time) AS click,
LAST_VALUE(buy) OVER (ORDER BY time) AS buy
FROM
query_1_result
⚠ Query (2)
time view click buy
100 100
200 200
300 300
400 400
500 500
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 200
300 300
400 400
500 500
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300
400 400
500 500
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300 NULL NULL
400 400
500 500
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300 NULL NULL
400 NULL 400 NULL
500 500
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300 NULL NULL
400 NULL 400 NULL
500 NULL 500 NULL
600 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300 NULL NULL
400 NULL 400 NULL
500 NULL 500 NULL
600 NULL NULL 600
⚠ Query (2)
time view click buy
100 100 NULL NULL
200 NULL 200 NULL
300 300 NULL NULL
400 NULL 400 NULL
500 NULL 500 NULL
600 NULL NULL 600
⚠ Query (2)
#standardSQL
SELECT
LAST_VALUE(view IGNORE NULLS) OVER (ORDER BY time) AS view,
LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click,
LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy
FROM
query_1_result
✅ Query (2)
time view click buy
100 100
200 200
300 300
400 400
500 500
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 200
300 300
400 400
500 500
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300
400 400
500 500
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300 200 NULL
400 400
500 500
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300 200 NULL
400 300 400 NULL
500 500
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300 200 NULL
400 300 400 NULL
500 300 500 NULL
600 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300 200 NULL
400 300 400 NULL
500 300 500 NULL
600 300 500 600
✅ Query (2)
time view click buy
100 100 NULL NULL
200 100 200 NULL
300 300 200 NULL
400 300 400 NULL
500 300 500 NULL
600 300 500 600
✅ Query (2)
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
Before (3)
time view click buy
100 100
200 100 200
300 300 200
400 300 400
500 300 500
600 300 500 600
<
After (3)
#standardSQL
SELECT
view,
(CASE WHEN view < click THEN click END) AS click,
(CASE WHEN click < buy THEN buy END) AS buy
FROM query_2_result
Query (3)
time view click buy
100 100
200 100 200
300 300
400 300 400
500 300 500
600 300 500 600
Before (4)
time view click buy
100 100
200 100 100
300 300
400 300 300
500 300 300
600 300 300 300
After (4)
#standardSQL
SELECT
(CASE WHEN view IS NOT NULL THEN view END) AS view,
(CASE WHEN click IS NOT NULL THEN view END) AS click,
(CASE WHEN buy IS NOT NULL THEN view END) AS buy
FROM query_3_result
Query (4)
time view click buy
100 100
200 100 100
300 300
400 300 300
500 300 300
600 300 300 300
Before (5)
view 2
click 2
buy 1
After (5)
#standardSQL
SELECT
"view" AS step,
COUNT(DISTINCT view) AS count
FROM query_4_result
UNION ALL
SELECT "click", COUNT(DISTINCT click)
FROM query_4_result
UNION ALL
SELECT "buy", COUNT(DISTINCT buy)
FROM query_4_result
Query (4)
Real World
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600
view 2
click 2 1
buy 1
#standardSQL
SELECT
LAST_VALUE(view IGNORE NULLS) OVER (ORDER BY time) AS view,
LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click,
LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy
FROM
query_1_result
Back to Query (2)
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600
Before (2)
user time view click buy
A 100 100
B 200 100 200
B 300 300 200
A 400 300 400
A 500 300 500
A 600 300 500 600
⚠ After (2)
user time view click buy
A 100 100
B 200 200
B 300 300 200
A 400 100 400
A 500 100 500
A 600 100 500 600
✅ After (2)
#standardSQL
SELECT
LAST_VALUE(view IGNORE NULLS)
OVER (PARTITION BY user ORDER BY time) AS view,
LAST_VALUE(click IGNORE NULLS)
OVER (PARTITION BY user ORDER BY time) AS click,
LAST_VALUE(buy IGNORE NULLS)
OVER (PARTITION BY user ORDER BY time) AS buy
FROM
query_1_result
✅ Query (2)
user time view click buy
A 100 100
A 400 400
A 500 500
A 600 600
PARTITION BY user
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600 user time view click buy
B 200 200
B 300 300
user time view click buy
A 100 100
A 400 100 400
A 500 100 500
A 600 100 500 600
LAST_VALUE & PARTITION BY
user time view click buy
A 100 100
B 200 200
B 300 300
A 400 400
A 500 500
A 600 600 user time view click buy
B 200 200
B 300 300 200
user time view click buy
A 100 100
A 400 100 400
A 500 100 500
A 600 100 500 600
user time view click buy
B 200 200
B 300 300 200
user time view click buy
A 100 100
B 200 200
B 300 300 200
A 400 100 400
A 500 100 500
A 600 100 500 600
LAST_VALUE & PARTITION BY
user time view click buy
A 100 100
B 200 200
B 300 300 200
A 400 100 400
A 500 100 500
A 600 100 500 600
user time view click buy
A 100 100
B 200 200
B 300 300 200
A 400 100 400
A 500 100 500
A 600 100 500 600
<
<
user time view click buy
A 100 100
B 200
B 300 300
A 400 100 400
A 500 100 500
A 600 100 500 600
user time view click buy
A 100 100
B 200
B 300 300
A 400 100 100
A 500 100 100
A 600 100 100 100
user time view click buy
A 100 100
B 200
B 300 300
A 400 100 100
A 500 100 100
A 600 100 100 100
user time view click buy
A 100 100
B 200
B 300 300
A 400 100 100
A 500 100 100
A 600 100 100 100
user time view click buy
A 100 100
B 200
B 300 300
A 400 100 100
A 500 100 100
A 600 100 100 100
100
300
100 100
view 2
click 1
buy 1
Thank you
Complete Query: https://git.io/vpzbF

More Related Content

Recently uploaded

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Building Funnels with Google BigQuery

  • 1. Building Funnels with Google BigQuery @devxoul
  • 3. 100 view 200 click 300 view 400 click 500 click 600 buy
  • 4. 100 view 200 click 300 view 400 click 500 click 600 buy
  • 5. 100 view 200 click 300 view 400 click 500 click 600 buy
  • 6. 100 view 200 click 300 view 400 click 500 click 600 buy
  • 9. time view click buy 100 100 200 200 300 300 400 400 500 500 600 600
  • 10. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600
  • 11. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600
  • 12. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600 origin next next
  • 13. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600 < origin next next
  • 14. time view click buy 100 100 200 100 200 300 300 400 300 400 500 300 500 600 300 500 600 origin next next
  • 15. time view click buy 100 100 200 100 200 300 300 400 300 400 500 300 500 600 300 500 600 origin next next
  • 16. time view click buy 100 100 200 100 100 300 300 400 300 300 500 300 300 600 300 300 300 origin next next
  • 17. time view click buy 100 100 200 100 100 300 300 400 300 300 500 300 300 600 300 300 300
  • 18. time view click buy 100 100 200 100 100 300 300 400 300 300 500 300 300 600 300 300 300 100 300 100 300 300
  • 20. Query
  • 21. 100 view 200 click 300 view 400 click 500 click 600 buy Before (1)
  • 22. time view click buy 100 100 200 200 300 300 400 400 500 500 600 600 After (1)
  • 23. Query (1) #standardSQL SELECT time, (CASE event WHEN "view" THEN time END) AS view, (CASE event WHEN "click" THEN time END) AS click, (CASE event WHEN "buy" THEN time END)AS buy FROM events
  • 24. time view click buy 100 100 200 200 300 300 400 400 500 500 600 600 Before (2)
  • 25. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600 After (2)
  • 26. #standardSQL SELECT LAST_VALUE(view) OVER (ORDER BY time) AS view, LAST_VALUE(click) OVER (ORDER BY time) AS click, LAST_VALUE(buy) OVER (ORDER BY time) AS buy FROM query_1_result ⚠ Query (2)
  • 27. time view click buy 100 100 200 200 300 300 400 400 500 500 600 600 ⚠ Query (2)
  • 28. time view click buy 100 100 NULL NULL 200 200 300 300 400 400 500 500 600 600 ⚠ Query (2)
  • 29. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 400 400 500 500 600 600 ⚠ Query (2)
  • 30. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 NULL NULL 400 400 500 500 600 600 ⚠ Query (2)
  • 31. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 NULL NULL 400 NULL 400 NULL 500 500 600 600 ⚠ Query (2)
  • 32. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 NULL NULL 400 NULL 400 NULL 500 NULL 500 NULL 600 600 ⚠ Query (2)
  • 33. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 NULL NULL 400 NULL 400 NULL 500 NULL 500 NULL 600 NULL NULL 600 ⚠ Query (2)
  • 34. time view click buy 100 100 NULL NULL 200 NULL 200 NULL 300 300 NULL NULL 400 NULL 400 NULL 500 NULL 500 NULL 600 NULL NULL 600 ⚠ Query (2)
  • 35. #standardSQL SELECT LAST_VALUE(view IGNORE NULLS) OVER (ORDER BY time) AS view, LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy FROM query_1_result ✅ Query (2)
  • 36. time view click buy 100 100 200 200 300 300 400 400 500 500 600 600 ✅ Query (2)
  • 37. time view click buy 100 100 NULL NULL 200 200 300 300 400 400 500 500 600 600 ✅ Query (2)
  • 38. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 400 400 500 500 600 600 ✅ Query (2)
  • 39. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 200 NULL 400 400 500 500 600 600 ✅ Query (2)
  • 40. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 200 NULL 400 300 400 NULL 500 500 600 600 ✅ Query (2)
  • 41. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 200 NULL 400 300 400 NULL 500 300 500 NULL 600 600 ✅ Query (2)
  • 42. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 200 NULL 400 300 400 NULL 500 300 500 NULL 600 300 500 600 ✅ Query (2)
  • 43. time view click buy 100 100 NULL NULL 200 100 200 NULL 300 300 200 NULL 400 300 400 NULL 500 300 500 NULL 600 300 500 600 ✅ Query (2)
  • 44. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600 Before (3)
  • 45. time view click buy 100 100 200 100 200 300 300 200 400 300 400 500 300 500 600 300 500 600 < After (3)
  • 46. #standardSQL SELECT view, (CASE WHEN view < click THEN click END) AS click, (CASE WHEN click < buy THEN buy END) AS buy FROM query_2_result Query (3)
  • 47. time view click buy 100 100 200 100 200 300 300 400 300 400 500 300 500 600 300 500 600 Before (4)
  • 48. time view click buy 100 100 200 100 100 300 300 400 300 300 500 300 300 600 300 300 300 After (4)
  • 49. #standardSQL SELECT (CASE WHEN view IS NOT NULL THEN view END) AS view, (CASE WHEN click IS NOT NULL THEN view END) AS click, (CASE WHEN buy IS NOT NULL THEN view END) AS buy FROM query_3_result Query (4)
  • 50. time view click buy 100 100 200 100 100 300 300 400 300 300 500 300 300 600 300 300 300 Before (5)
  • 51. view 2 click 2 buy 1 After (5)
  • 52. #standardSQL SELECT "view" AS step, COUNT(DISTINCT view) AS count FROM query_4_result UNION ALL SELECT "click", COUNT(DISTINCT click) FROM query_4_result UNION ALL SELECT "buy", COUNT(DISTINCT buy) FROM query_4_result Query (4)
  • 54. user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600
  • 55. user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600
  • 56. user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600
  • 57. view 2 click 2 1 buy 1
  • 58. #standardSQL SELECT LAST_VALUE(view IGNORE NULLS) OVER (ORDER BY time) AS view, LAST_VALUE(click IGNORE NULLS) OVER (ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (ORDER BY time) AS buy FROM query_1_result Back to Query (2)
  • 59. user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600 Before (2)
  • 60. user time view click buy A 100 100 B 200 100 200 B 300 300 200 A 400 300 400 A 500 300 500 A 600 300 500 600 ⚠ After (2)
  • 61. user time view click buy A 100 100 B 200 200 B 300 300 200 A 400 100 400 A 500 100 500 A 600 100 500 600 ✅ After (2)
  • 62. #standardSQL SELECT LAST_VALUE(view IGNORE NULLS) OVER (PARTITION BY user ORDER BY time) AS view, LAST_VALUE(click IGNORE NULLS) OVER (PARTITION BY user ORDER BY time) AS click, LAST_VALUE(buy IGNORE NULLS) OVER (PARTITION BY user ORDER BY time) AS buy FROM query_1_result ✅ Query (2)
  • 63. user time view click buy A 100 100 A 400 400 A 500 500 A 600 600 PARTITION BY user user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600 user time view click buy B 200 200 B 300 300
  • 64. user time view click buy A 100 100 A 400 100 400 A 500 100 500 A 600 100 500 600 LAST_VALUE & PARTITION BY user time view click buy A 100 100 B 200 200 B 300 300 A 400 400 A 500 500 A 600 600 user time view click buy B 200 200 B 300 300 200
  • 65. user time view click buy A 100 100 A 400 100 400 A 500 100 500 A 600 100 500 600 user time view click buy B 200 200 B 300 300 200 user time view click buy A 100 100 B 200 200 B 300 300 200 A 400 100 400 A 500 100 500 A 600 100 500 600 LAST_VALUE & PARTITION BY
  • 66. user time view click buy A 100 100 B 200 200 B 300 300 200 A 400 100 400 A 500 100 500 A 600 100 500 600
  • 67. user time view click buy A 100 100 B 200 200 B 300 300 200 A 400 100 400 A 500 100 500 A 600 100 500 600 < <
  • 68. user time view click buy A 100 100 B 200 B 300 300 A 400 100 400 A 500 100 500 A 600 100 500 600
  • 69. user time view click buy A 100 100 B 200 B 300 300 A 400 100 100 A 500 100 100 A 600 100 100 100
  • 70. user time view click buy A 100 100 B 200 B 300 300 A 400 100 100 A 500 100 100 A 600 100 100 100
  • 71. user time view click buy A 100 100 B 200 B 300 300 A 400 100 100 A 500 100 100 A 600 100 100 100
  • 72. user time view click buy A 100 100 B 200 B 300 300 A 400 100 100 A 500 100 100 A 600 100 100 100 100 300 100 100
  • 74. Thank you Complete Query: https://git.io/vpzbF