# Design an Ad Click Aggregator

DevFeed: [Design an Ad Click Aggregator](<https://devfeed.tech/articles/design-an-ad-click-aggregator-32312.md>)

Original publisher: [Read original article](<https://evanking1.medium.com/design-an-ad-click-aggregator-53c4da56c264?source=rss-9736778727ef------2>)

Author: Evan King

Published: 2024-12-04T04:20:50Z

Content type: tutorial

Language: en

Sources: [Evan King](<https://devfeed.tech/sources/evan-king.md>)

Topics: [data-processing](<https://devfeed.tech/topics/data-processing.md>), [Requirements](<https://devfeed.tech/topics/requirements.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [realtime](<https://devfeed.tech/topics/realtime.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [data-processing](<https://devfeed.tech/tags/data-processing.md>), [database](<https://devfeed.tech/tags/database.md>), [latency](<https://devfeed.tech/tags/latency.md>), [performance](<https://devfeed.tech/tags/performance.md>), [query](<https://devfeed.tech/tags/query.md>), [realtime](<https://devfeed.tech/tags/realtime.md>), [requirements](<https://devfeed.tech/tags/requirements.md>), [scale](<https://devfeed.tech/tags/scale.md>)

## AI overview

A tutorial on designing an ad click aggregator. It defines functional and non-functional requirements, including advertiser metric queries, scalability, low-latency analytics, fault-tolerant and accurate collection, near-real-time availability, and idempotent click tracking.

## Source excerpt

By a former Meta Staff engineer and Co-founder of hellointerview.comFinal DesignUnderstanding the Problem🖱 What is an Ad Click Aggregator An Ad Click Aggregator is a system that collects and aggregates data on ad clicks. It is used by advertisers to track the performance of their ads and optimize their campaigns. For our purposes, we will assume these are ads displayed on a website or app, like Facebook.Functional Requirements Core Requirements Users can click on an ad and be redirected to the advertiser's website Advertisers can query ad click metrics over time with a minimum granularity of 1 minute Below the line (out of scope): Ad targeting Ad serving Cross device tracking Integration with offline marketing channels Non-Functional Requirements Before we jump into our non-functional requirements, it's important to ask your interviewer about the scale of the system. For this design in particular, the scale will have a large impact on the database design and the overall architecture. We are going to design for a system that has 10M active ads and a peak of 10k clicks per second. The total number of clicks per day will be around 100M. With that in mind, let's document the non-functional requirements: Core Requirements Scalable to support a peak of 10k clicks per second Low latency analytics queries for advertisers (sub-second response time) Fault tolerant and accurate data collection. We should not lose any click data. As realtime as possible. Advertisers should be able to query data as soon as possible after the click. Idempotent click tracking. We should not count the same click multiple times. Below the line (out of scope): Fraud or spam detection Demographic and geo profiling of users Conversion tracking Here's how it might look on your whiteboard: The Set UpPlanning the Approach For this question, which is less of a user-facing product and more focused on data processing, we're going to follow the delivery framework outlined here, focusing on the system interfa