Have you ever seen an ad on your Facebook or Instagram feed that relates to your passion, sporting activity or interests? It's perfectly normal. Meta (the parent company of Facebook and Instagram) offers today's most personalized advertising experience. With over 15 million active ad campaigns on the planet every day, Facebook is the world's second largest ad provider (after Google). But how is a specific ad selected by the Facebook Ads algorithm to be shown to a user? How does Facebook sort advertisers and manage bids from different companies wishing to show their ads? In short, how does the Facebook Ads algorithm work? Answers in this article.
The general architecture of the Facebook Ads algorithm
Taking a step back from the technical side of things, choosing which ads to serve to a user via Facebook Ads is pretty straightforward. The algorithm fetches ads from a database. It ranks them according to the likelihood of the user clicking on the ad.
The bidding process begins and the ad is selected for delivery to the user. These steps may seem simple, but in detail each one is particularly technical. Let’s take a closer look.
Ad selection in the database
In the Facebook Ads database, there are generally between 10 and 100 million ads ready to be served (or in the process of being served). The algorithm then applies a filter to eliminate all ads not relevant to the user’s profile.
Meta will then use the characteristics of the user’s profile:
- Age, gender, language, location, number of friends, number of pages liked for a specific interest, number of friends with the same interest.
- The implicit meaning of the user’s profile text and profile photo.
- User ID, number of pages visited by the user, IDs of closest friends.
Meta also detects the particular context the user is in, such as a time of year, time of day, holiday, birthday or election period. For example, a user living in Lille in January will not see ads for swimwear.
The algorithm also details the characteristics of the ad:
- When the ad campaign was created, the number of ads created by the advertiser,
- The meaning of the visual ad, the meaning of the text…
- The ad’s ID, the IDs of ads in the same ad account…
Finally, the algorithm will analyze the interactions between the user and ads on Meta platforms:
- The number of times the user clicks on an ad, what types of ads they tend to click on…
- The type of ads the user clicks on, which ones they see…
This first step in the process keeps between 100,000 and 1 million potential ads.
Ad ranking by the Facebook Ads algorithm
The algorithm goes through two stages to sort the maximum number of remaining ads: a fast sort and a slower sort to ensure that the right ad is displayed.
First, the algorithm has to manage a large number of ads and filter out those most relevant to the user’s profile, being relatively fast to minimize waiting times. In this case, Meta uses a subset of features that give it this speed of execution. This first ranking keeps between 100 and 1,000 potential ads.
Next comes the slower ranking of the remaining ads. The algorithm then uses a more complex model to promote precision and better predictive performance. Only the best-ranked ads are retained for the next phase. At the end of this stage, only ten or so potential ads remain.
How auctions work
As a reminder, Facebook Ads works on a Pay-Per-Click (PPC) basis, meaning that an advertiser only pays when a user clicks on the ad. Meta therefore takes into account the daily budget set by the advertiser for a certain period when creating the campaign.
The algorithm estimates the cost the advertiser is willing to pay per click. Ads are then ranked according to their offer and the likelihood of the user clicking on the ad. The winning ad is shown to the user.
How is the bid calculated?
Now that you’ve understood how an ad is selected and the types of criteria taken into account by the Facebook Ads algorithm, it’s time to find out how the bid is calculated. This is a key factor in determining which ads are shown and which are not. This process allows ads to be organized according to the advertiser’s offer and the quality of the ad. The formula can be summarized as follows:
Ad ranking = Bid X p(user will click) + Ad quality
→ The bid corresponds to the maximum amount an advertiser is willing to pay to get one click on its ad.
→ P(user will click) corresponds to the probability calculated according to the recommendation model.
→ Ad quality corresponds to an estimate of the relevance of an ad based on users’ actions vis-à-vis that ad.
When creating an advertising campaign, the advertiser generally does not specify a specific bid. Instead, they define a daily or campaign budget and its duration. For example, the advertiser defines a 7-day campaign for a budget of €100. Meta will then estimate how many times the ad is likely to be shown.
To return to our example, let’s imagine that the estimate is 35,00 times in 7 days. If the click-through rate is 1%, then the number of clicks will be 35,000 x 0.01 = 350. The cost per click is therefore 100 divided by 350, or around 30 cents. Based on the advertiser’s initial budget and average click-through rate, Meta is able to calculate a bid value for the campaign. This bid can be adjusted over the course of an advertising campaign according to results, budget and days remaining.
The Facebook Ads algorithm at a glance
The Facebook Ads algorithm is used to show the most relevant ads to users. It includes various filters to sort the millions of ads in its database and then applies an auction to determine which ad will be shown to the targeted user.