Last updated
Analyze customer web events to understand product brand interest, campaign funnel performance, and user-level engagement behavior.
Analyze customer web events to understand product brand interest, campaign funnel performance, and user-level engagement behavior.
Your dataset contains two tables from a web analytics system: 1. A Web_Events table recording each customer interaction — page views, add-to-cart, checkout, purchase, and search events — along with the campaign, session, and a JSON field containing event details 2. A Products table with product_id, product_name, brand, and category
| Column | Type | Key / Notes |
|---|---|---|
| event_id | INT | PK |
| customer_id | VARCHAR(20) | |
| event_date | DATE | |
| event_type | VARCHAR(50) | |
| session_id | VARCHAR(50) | |
| utm_campaign | VARCHAR(50) | |
| event_json | TEXT |
| Column | Type | Key / Notes |
|---|---|---|
| product_id | INT | PK |
| product_name | VARCHAR(100) | |
| brand | VARCHAR(50) | |
| category | VARCHAR(50) |
Products — 6 rows
| product_id | product_name | brand | category |
|---|---|---|---|
| 101 | Wireless Earbuds | boAt | Electronics |
| 102 | Smart Watch | Noise | Electronics |
| 103 | Running Shoes | Puma | Footwear |
| 104 | Denim Jacket | Levi's | Fashion |
| 105 | Backpack | Skybags | Accessories |
| 106 | Bluetooth Speaker | JBL | Electronics |
Web_Events — 30 rows
| event_id | customer_id | event_date | event_type | session_id | utm_campaign | event_json |
|---|---|---|---|---|---|---|
| 1 | C001 | 2025-08-02 | page_view | S001 | SummerSale | {"product_id":101,"page":"product"} |
| 2 | C001 | 2025-08-02 | add_to_cart | S001 | SummerSale | {"product_id":101,"page":"cart"} |
| 3 | C001 | 2025-08-02 | checkout | S001 | SummerSale | {"product_id":101,"page":"checkout"} |
| 4 | C001 | 2025-08-02 | purchase | S001 | SummerSale | {"product_id":101,"page":"success"} |
| 5 | C002 | 2025-08-05 | page_view | S002 | SummerSale | {"product_id":102,"page":"product"} |
| 6 | C002 | 2025-08-05 | add_to_cart | S002 | SummerSale | {"product_id":102,"page":"cart"} |
| 7 | C002 | 2025-08-05 | checkout | S002 | SummerSale | {"product_id":102,"page":"checkout"} |
| 8 | C003 | 2025-08-10 | page_view | S003 | SummerSale | {"product_id":103,"page":"product"} |
| 9 | C003 | 2025-08-10 | add_to_cart | S003 | SummerSale | {"product_id":103,"page":"cart"} |
| 10 | C004 | 2025-08-12 | page_view | S004 | FestiveOffer | {"product_id":104,"page":"product"} |
| 11 | C004 | 2025-08-12 | add_to_cart | S004 | FestiveOffer | {"product_id":104,"page":"cart"} |
| 12 | C004 | 2025-08-12 | checkout | S004 | FestiveOffer | {"product_id":104,"page":"checkout"} |
| 13 | C004 | 2025-08-12 | purchase | S004 | FestiveOffer | {"product_id":104,"page":"success"} |
| 14 | C005 | 2025-08-15 | page_view | S005 | FestiveOffer | {"product_id":105,"page":"product"} |
| 15 | C005 | 2025-08-15 | add_to_cart | S005 | FestiveOffer | {"product_id":105,"page":"cart"} |
| 16 | C006 | 2025-08-18 | page_view | S006 | FestiveOffer | {"product_id":106,"page":"product"} |
| 17 | C006 | 2025-08-18 | checkout | S006 | FestiveOffer | {"product_id":106,"page":"checkout"} |
| 18 | C007 | 2025-08-20 | page_view | S007 | NewLaunch | {"product_id":101,"page":"product"} |
| 19 | C007 | 2025-08-20 | add_to_cart | S007 | NewLaunch | {"product_id":101,"page":"cart"} |
| 20 | C007 | 2025-08-20 | purchase | S007 | NewLaunch | {"product_id":101,"page":"success"} |
| 21 | C008 | 2025-08-22 | page_view | S008 | NewLaunch | {"product_id":106,"page":"product"} |
| 22 | C008 | 2025-08-22 | add_to_cart | S008 | NewLaunch | {"product_id":106,"page":"cart"} |
| 23 | C008 | 2025-08-22 | checkout | S008 | NewLaunch | {"product_id":106,"page":"checkout"} |
| 24 | C009 | 2025-08-25 | search | S009 | NewLaunch | {"keyword":"earbuds"} |
| 25 | C001 | 2025-08-28 | page_view | S010 | SummerSale | {"product_id":102,"page":"product"} |
| 26 | C001 | 2025-08-28 | add_to_cart | S010 | SummerSale | {"product_id":102,"page":"cart"} |
| 27 | C002 | 2025-08-30 | purchase | S011 | SummerSale | {"product_id":102,"page":"success"} |
| 28 | C003 | 2025-09-01 | page_view | S012 | FestiveOffer | {"product_id":103,"page":"product"} |
| 29 | C003 | 2025-09-01 | add_to_cart | S012 | FestiveOffer | {"product_id":103,"page":"cart"} |
| 30 | C003 | 2025-09-01 | purchase | S012 | FestiveOffer | {"product_id":103,"page":"success"} |
This drill has three questions: 1. Add to Cart by Brand — Compute total add_to_cart counts per product brand, sorted highest first. Your result table should have: brand, total_add_to_cart. 2. Campaign Funnel — Create a funnel showing page_view → add_to_cart → checkout → purchase conversion rates per campaign (exclude search events). Your result table should have: utm_campaign, event_type, cnt, rate. 3. User Feature Table — Build a per-user feature table using 2025-09-01 as the reference date (30-day window). Your result table should have: customer_id, last_event_date, no_of_sessions, add_to_carts, purchases.
Your output should look like this (partial example):
| brand | total_add_to_cart |
|---|---|
| Noise | 2 |
| boAt | 2 |
| … | … |