Advertiser Conversion Rate Drop

Start Timer

0:00:00

Upvote
1
Downvote
Save question
View comments

Let’s say at Meta we log ad events in three tables: impressions, clicks and conversions. Write a query that returns the advertisers whose conversion rate dropped by more than 20% from one week to the next, along with the two week-start dates, both conversion rates, and both weeks’ CTR.

Rules - Duplicate rows exist in all three tables (the same event_id can appear more than once). Count each event only once. - All rates are per advertiser per ISO week. - CTR is deduplicated clicks over deduplicated impressions. If a week has clicks but no impressions, report its CTR as NULL. - Conversion rate is the number of distinct users who converted over deduplicated clicks. - Exclude weeks with zero deduplicated clicks. - Compare each week against the most recent earlier week with deduplicated clicks for the same advertiser. - A drop of more than 20% means the later conversion rate is below 80% of the earlier one.

Example:

Input:

impressions table

Column Type
event_id INTEGER
advertiser_id INTEGER
user_id INTEGER
shown_at DATETIME

clicks table

Column Type
event_id INTEGER
advertiser_id INTEGER
user_id INTEGER
clicked_at DATETIME

conversions table

Column Type
event_id INTEGER
advertiser_id INTEGER
user_id INTEGER
converted_at DATETIME

Output:

Column Type
advertiser_id INTEGER
prev_week DATE
curr_week DATE
prev_rate FLOAT
curr_rate FLOAT
prev_ctr FLOAT
curr_ctr FLOAT
.
.
.
.
.


Comments

Loading comments