Using machine learning to automate mobile marketing budgets

Posted on October 22, 2018 by Eric Benjamin Seufert

This guest post was written by Jacques Frisch, the director of digital marketing at Glovo, a Barcelona-based service-on-demand platform.

A nice problem

It all starts with an industry-common problem. At our start-up, Glovo, we’re good at expansion. Glovo is a city-based service-on-demand mobile platform focusing primarily on large metropolitan areas. The challenge is called “hyper-local”. We currently launch new cities on a monthly basis. In order to keep up with that pace, both budgets and the team have to grow gradually.

There are companies that launch new markets per country. Still, just because your application is available worldwide, it doesn’t necessarily mean that you want to spend marketing dollars in each country around the globe.

In our case, launching a new market means launching a city. Within a year, we scaled from ten cities across four countries to eighty cities across twenty countries. Thrilling! (figure 1,2).

Figure 1: Launching countries strategy
Figure 2: Launching cities strategy

 

When defining and managing quarterly and monthly digital marketing budgets, each new launch adds more variables to the equation. Each new city launched means your total budget is being broken down further. Allocating budgets across multiple combinations represents an approach known as Multi-Armed Bandit (Robbins, 1952). It got its name from the famous one-arm bandit slot machines and it describes the problem each Las Vegas gambler faces: which machine gives the highest return of investment for my budget?

In order to find this out, one had to play all slot machines available, one after another, hence going with multiple arm rather than just for arm. The same problem occurs in digital advertising.

Here’s a basic example:

Let’s say you’ve got a monthly budget of $100k. You operate in three countries, where your service is live in four cities each. If you’d equally distribute your budget, you’d put about $33k to each country, then break that down to four and split the city budget across acquisition channels. Let’s just use Facebook and Google to keep it simple. And if you’re a mobile first company and have got one application available in each major store, you want to split that budget once again, not equally, but proportionally.

Figure 3 — Multi-Armed Bandit: budget distribution with hyper-local approach, per country, city channel.
Figure 4 — Multi-Armed Bandit: budget distribution with hyper-local approach, per country, city, channel and OS.

 

In the case above I used a rather equal budget distribution as an example. However, this is not practical. A realistic budget allocation depends on many factors such as previous performance of each GEO/channel/OS and the potential user reach of each one. When looking at hyper-local targets, what matters is “how much will I be able to actually spend?” What’s the strategy and company priority, in addition to other factors such as how much is the competition spending? What’s the best timing to increase my spend, per day, week, month and season of the year? Finally, when is my offline marketing wave kicking in?

Second machine age

Rule #1 of Machine Learning

Don’t be afraid to launch a product without machine learning.

[Martin Zinkevich, Google, Best Practices for ML Engineering]

Following our pace, we’ve reached the ceiling of manual budgeting processes pretty quickly. A lot faster than I experienced working for other tech projects in the past. It became clear after some months that we won’t be able to regularly optimize and re-distribute budgets among all acquisition channels and campaigns smart enough any longer, if we keep doing it manually. It’s not so much about accuracy rather than the potential to scale.

The solution: automation.

Being aware of there are third-party tools in the market offering this sort of ready-made product, we’ve come soon to the conclusion that this is something we should master internally, entirely tailored to our own needs. I then got a former co-worker and friend, Anthony Merlo, involved. A full-stack senior software engineer who seemed more than capable of doing the job. Together with the BI team we agreed on a plan and here’s how we’ve been tackling this problem since…

Thinking out loud first sounded like: “Machine Learning!” — A trending topic in the tech world these days. However, we’ve figured out early on, that before applying any ML algorithms to this, we need to get the basics right, which meant, all the manual work tasks we’ve been doing on a weekly basis had to be automated first. We put each one of them down into a spread sheet. That means, all things being taken into consideration when it comes to (re-)allocating digital campaign budgets.

A great way of doing this is to define rules, from very basic and generic to more detailed and specific. For instance, a basic rule could be something like:

“If my customer acquisition cost (CAC) of campaign A is lower than $XX, increase the budget by X% on a daily/weekly basis, as long as the CAC remains the same, gets lower or increases to maximum $XX.”

Next, add a similar rule for the opposite logic, to decrease a campaign budget if the CAC is getting too high. We defined rules based on CAC and ROAS goals. Some rules are even based on timings, e.g. to increase budgets by 20% if the daytime is equal to 7–11pm, the weekday is Sunday or the date of the month is between the 23rd and 31th (pay week!). Breaking it down, there are three types of automation rules defined:

– Change budgets (increase/decrease)

– Change bids (increase/decrease)

– Change campaign status (active/paused)

So far, sets of rules for Google Ads, Facebook and Apple Search Ads have been created and they are constantly being reviewed and updated. As different channels work differently when it comes to bidding and budgeting logic, each set of rules is specific to the acquisition channel.

From text to code

As a next step, all rules defined were implemented directly into sets of JavaScript snippets onto a dashboard of a custom tool our developer created. That platform receives all data from external APIs. Pulling attribution data from the Adjust partner and cost and performance data via the ad networks’ APIs. If you use a data aggregation platform such as Singular, you might want to pull all aggregated data directly via their API. Hence, the first beta of this custom budgeting automation application was born (figure 5).

Moving on, we started fine-tuning and testing the first automated performance campaigns. There’s a simple campaign selector, which you can pick all campaigns you’d like to run automations for with. Each campaign includes country and city information in its name, so you could just pick the ones for one specific country with a minor daily spend level to counter test the automation rules against other GEOs with larger budgets and importance.

Figure 5 — Controlling inputs and representing outputs: custom budgeting automation application setup.
Figure 6 — Selecting, reviewing and submitting campaign budgets using custom application.

 

There are two main steps this budgeting automation does so far:

a) Analyze all past campaign performance, e.g. last 30 days and suggest budget re-allocation based on results. The criteria for decision making are based on human inputs (i.e. the rules we defined).

b) Push suggested changes to the ad networks and update all campaign budgets selected automatically (figure 6).

First, only step a) was automated to be sure the suggested changes are correct. We still had to submit the changes manually. Once happy with the results we let the application automate b), too. Then, an automation scheduler was added, so you wouldn’t have to launch the automation manually, but program it for twice per week for example. We also implemented a simple email reporting feature to it (figure 7), so any change made can be sent to any email recipient that would like to be notified.

Figure 7 — Schedule feature: set how often the automation should be run.

Rage against…

We initially created the first beta of this application with one main goal: automate manual processes in order to help scale in a sustainable way.Along the way a dozen of hurdles had been taken, rules tested and bugs fixed.

The one million dollar question now is: will we be able to improve campaign performance by automating budget allocation as well?

In her master thesis Profit maximization through budget allocation in display advertising (2017, Aalto university), Suvi Mäkinen presents updates to existing machine learning studies focusing on digital advertising. She doesn’t only successfully test several ML models, which can solve the problem of automated budget allocation, but also gives scientific evidence that

“dynamically optimizing advertising budgets can substantially improve the advertiser’s return on investment”, in her tests, by up to 30%.

That paper has been the main reference and inspiration for most of our testing since. We started playing around with implementing one of the algorithms suggested, the ε-GreedyMäkinen’s approach can be interpreted as a “batched-arm bandit”, as multiple ML models were tested at the same time. This sounds like the ideal way of doing this. Imagine you can play all slot machines at the MGM Grand at once, so you’re gonna get a proper result of which one gives you the highest ROI.

The ε-Greedy is a pretty intriguing algo. What it does is allocating the largest amount of a budget to the best performing campaign and distribute the rest of the budget equally among all other campaigns. Then, it adds some randomness once in a while and assigns the largest amount to one of the other campaigns, to give them a chance to outperform.

Cool, but pretty obvious that this approach isn’t accurate enough for our use case. We’d rather come up with an algorithm that works along a ranking-based system, i.e. always giving the largest amount to the best campaign, the second largest to the second best and so on. The worst performing campaigns should not receive an important part of the budget or even be deactivated.

We’re clearly not there yet.

Yesterday, today and tomorrow

An outlook.

The way Mäkinen found the best ML algorithm suited to solve the multi-armed problem was to combine multiple models and let them compete against each other. She tested for instance different Greedys versus Thompson sampling and concluded that Greedy algorithms outperform other models. This is something we’re gonna have to explore next. In the end, there’s never one ideal solution, but there’s a challenge:

Can we create a system that is not only making a decision for today, but will be able to predict future performance, by allocating budgets in a way the ideal sweet spot between the spend and revenue curve is being hit, at any given budget or bidding change? (Figure 8)

Figure 8 — Spend vs. Revenue forecast model

 

The goal is to add an additional step c) to the two mentioned above.

a) Analyze all past campaign performance, e.g. last 30 days and suggest budget re-allocation based on results. The criteria for decision making are based on human inputs (i.e. the rules we defined).

b) Push suggested changes to the ad networks and update all campaign budgets selected.

c) Predict future ROAS at different spend and bidding levels

Therefore, the third job the app should do is to analyze a historic time period (e.g. three to six months of past data) to then suggest the ideal budget allocation for the upcoming three to six months. A typical use case for this would be planning quarterly budgets. Right now, we still do that based on manual performance analysis and future plans.

There are currently solutions on the market which provide similar solutions, but our aim is to create a custom solution, even smarter than anything we’ve come across so far.

So, now the exploration phase actually starts and it is going to be exciting!

Please feel free to share your own experiences about this topic and your approaches. Shout-outs go to an amazing digital marketing and BI team at Glovo and to Anthony Merlo, who brought all of the above to life.

 

Jacques Frisch has been working for tech startup since 10 years and focusses on mobile app growth. He is responsible for digital marketing at Glovo, a Barcelona based service-on-demand platform, which makes anything in cities accessible within minutes.