Ad Click to Purchase Funnel After Removing Accidental Double Clicks
Last updated: November 29, 2026
Quick Overview
Ad click logs contain repeated clicks fired within seconds of each other. Remove clicks that come within 10 seconds of the same user's previous click on the same ad, then compute per campaign the click to landing page view to purchase funnel within one day of each kept click.
Meta
November 29, 20260
0
0 solved
Ad click logs contain repeated clicks fired within seconds of each other. Remove clicks that come within 10 seconds of the same user's previous click on the same ad, then compute per campaign the click to landing page view to purchase funnel within one day of each kept click.
A data quality plus funnel question in the style of Meta's ads data engineering onsite. The interviewer checks dedupe logic with LAG, the decision about chained rapid clicks, and a click-grain funnel that does not double count a single purchase across many clicks.
What the Interviewer Expects
- Dedupes clicks with LAG within user and ad
- States how chains of rapid clicks are treated
- Joins landing views and purchases at the click grain with time windows
- Prevents one purchase from being credited to several clicks
- Reports dedupe volume as a data quality metric
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you instead dedupe on a fixed 10-second window from the first click of a burst?
- How would you credit a purchase to only the most recent click before it?
- Why might landing page views exceed kept clicks for some campaigns?
- How would you monitor the duplicate rate over time?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
ad_clicks(click_id, user_id, ad_id, campaign_id, click_ts), lp_views(user_id, ad_id, view_ts), purchases(purchase_id, user_id, ad_id, purchase_ts). A click is a duplicate if the same user clicke...
Approach
Step 1: LAG(click_ts) per (user, ad) and keep clicks with no prior click or a gap over 10 seconds. Step 2: mark landing views within one day after each kept click. Step 3: assign each purchase to it...