User Acquisition Automation

Top 5 Facebook Marketing API Scripts

Maximise your performance with automation
Share on facebook
Share on linkedin
Share on twitter

If you’re a Performance Marketer and Facebook is one of the largest channels you manage, a simple understanding of the Facebook Marketing API can supercharge your efficiency. Running a small Facebook account is completely feasible using Facebook Ads Manager, but as soon as you’ve achieved a certain degree of scale, simple tasks become time-consuming and limit you from making strategic decisions. There are also some features which are only available via the Marketing API that can give you a competitive edge.

At Miri, we use numerous different scripts that saves time on the manual tasks of campaign management and allows us to focus our energy on the things that actually impact campaign performance: creative brainstorming, creative testing, and audience testing strategies. As self-taught coders, we’ve found Python to be the easiest programming language for beginners. Our biggest takeaway? Don’t be afraid to get your hands dirty – you can only learn through practice.

Here are 5 of our most used Facebook Marketing API scripts that you can incorporate to enhance your campaign management workflow.

Note: we only work with Mobile Apps so, naturally, all of these scripts are intended for Mobile App Campaigns. The API calls below are coded in Python.

1. Update Adset and Campaign Budgets

Use this script to push Adset and Campaign budget optimisations. We use a combination of automated recommendations and manual analysis to establish when is a good time to scale up, scale down, keep budgets constant, or pause. Once the decisions are made, you can run a simple script to action these changes immediately.

Update Adset and Campaign Budgets – click to view code

2. Update Adset Bids

In all cases where you’re not using Auto Bid, your adset bid should be considered as much as your budget. Especially with campaign budget optimisation (CBO), bid optimisation has become the lever we have to pull to dictate the amount of delivery a specific adset will get.

Update Adset Bids – click to view code

3. Rollout a New Ad

When you’ve found a new top-performing ad in your creative testing framework, it’s important to be able to scale it quickly and efficiently. We often find it helpful to keep a creative-rollout backlog to save a new concept for when creative fatigue inevitably kicks in.

This script can also be adapted to take localisation into account and hence bulk rollout a single ad concept in all languages.

Rollout a New Ad – click to view code

4. Generate an ABCLA

Some Facebook functionalities are only available via the Facebook Marketing API before it can be found on Ads Manager. One of those is Ad set Based Conversion Lookalikes (ABCLAs), which use existing ad set conversions to build a Lookalike. At Miri, we’ve seen firsthand multiple cases of strong success running ABCLAs.

Generate an ABCLA – click to view code

5. Expanding Lookalikes above 10%

Another exclusive functionality of the Facebook Marketing API is being able to create lookalikes reaching more than 10% of the audience in a certain geo or region. Expanding Lookalikes above 10% – click to view code

Next Steps

These are just a handful of the scripts we use to help us to cut out time-consuming manual tasks and maximise our performance. We’d encourage you to dig into the Facebook Marketing API Documentation and see what could be useful for your campaigns.

Got any questions? Have you developed an even better script that’s saved you tons of time? Tweet us @mirigrowth

Zachary van Driel

Zachary van Driel

Zach entered the digital market in 2013, co-founding an eCommerce male fashion shop that closed after a successful 3 years. After completing his Bachelors in Mathematics, he immediately entered the mobile space at Peak in 2016, joining Adam in the User Acquisition Team, before the pair co-founded Miri Growth in 2017.

More Articles

Thanks, your message has been sent

We'll be in touch shortly.