This book covers the use of Redis, an in-memory database/data structure server.

open all | close all

7.3.1 What’s an ad server?

When we talk about an ad server, what we really mean is a sometimes-small, but sophisticated
piece of technology. Whenever we visit a web page with an ad, either the web
server itself or our web browser makes a request to a remote server for that ad. This ad
server will be provided a variety of information about how to find an ad that can earn
the most money through clicks, views, or actions (I’ll explain these shortly).

In order to choose a specific ad, our server must be provided with targeting parameters.
Servers will typically receive at least basic information about the viewer’s location
(based on our IP address at minimum, and occasionally based on GPS
information from our phone or computer), what operating system and web browser
we’re using, maybe the content of the page we’re on, and maybe the last few pages
we’ve visited on the current website.

We’ll focus on building an ad-targeting platform that has a small amount of basic
information about viewer location and the content of the page visited. After we’ve
seen how to pick an ad from this information, we can add other targeting parameters

ADS WITH BUDGETSIn a typical ad-targeting platform, each ad is provided
with a budget to be spent over time. We don’t address budgeting or accounting
here, so both need to be built. Generally, budgets should at least attempt
to be spread out over time, and as a practical approach, I’ve found that adding
a portion of the ad’s total budget on an hourly basis (with different ads
getting budgeted at different times through the hour) works well.

Our first step in returning ads to the user is getting the ads into our platform in the first place.