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

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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