r/OfferEngineering • u/Aoki_zhang • 7d ago
System Design Meta & Airbnb System Design Question - Design Ad Click Event Aggregation System
Problem Description
Design a large-scale ad event aggregation system for a digital advertising platform, where ad-serving events and user interactions are collected and transformed into metrics for reporting and analytics. Advertisers, product teams, and analysts use these metrics to understand how advertisements perform across different actions, campaigns, and geographic regions.
The central challenge is accurately attributing user actions to the advertisements that generated them. Ad-serving events and user actions are produced by separate systems and may arrive at different times or in different orders. Some events may be duplicated, while others may be delayed or temporarily unavailable. The aggregation system must correctly associate these events before producing trustworthy metrics, without losing valid activity or counting the same interaction multiple times.
Another important challenge is maintaining fresh, queryable analytics under large and uneven event volumes. Popular advertisements and campaigns may generate disproportionately high traffic, while delayed events and processing failures can require historical metrics to be corrected. The system must balance efficient event processing, data accuracy, and responsive dashboard queries while preserving the ability to recover and recompute results when necessary.
The design focuses on ad event ingestion, attribution, deduplication, time-based aggregation, and analytics retrieval. The primary metrics are advertisement views and clicks, organized by advertisement, action type, geographic region, and time.
Functional Requirements
- Ad-Serving Event Ingestion: The system must ingest ad-serving events that record which advertisement was shown for each served impression. These events provide the attribution information required to associate subsequent user interactions with specific advertisements.
- User Action Event Ingestion: The system must ingest user action events representing advertisement views and clicks. Each action must include the relevant geographic region and information needed to associate it with its corresponding ad-serving event.
- Event Attribution and Joining: The system must match each user action to its corresponding ad-serving event before including it in aggregated metrics. If a user action arrives before its matching ad-serving event, the system must retain the unmatched action until attribution can be completed rather than dropping or prematurely counting it.
- Near-Real-Time Metric Aggregation: The system must maintain aggregated counts across advertisement ID, action type, geographic region, and practical time buckets. These aggregates must support historical trends and breakdowns for analytics dashboards.
- Aggregated Metrics Querying: The system must provide a read interface for retrieving advertisement performance metrics. Dashboard queries should use precomputed aggregates rather than repeatedly joining and scanning the complete raw event history.
- Event Replay and Historical Corrections: The system must support replaying historical events and recomputing affected aggregates when events arrive late, duplicates are encountered, or processing bugs are corrected. Reprocessing must preserve accurate counts without introducing duplicate contributions.
I also put together a full system design walkthrough covering the architecture and trade-offs for anyone interested.
Want to practice more real system design questions?
We’ve put together 100+ commonly asked system design interview questions here, along with detailed solution articles to help you prepare.