# Skip to main content

WEBINAR|Apple Search Ads Problem Solving: A Strategy Workshop

Basic Scripted Automation Rules for Search Ads Maven

By January 24, 2023April 9th, 2024No Comments6 min read Product

Quick examples to optimize Apple Search Ads (ASA) campaigns

2023 just started but it’s clear that the industry is looking at very tight ad budgets for the near future. On top of ad budgets, it’s clear that the choices for attribution in iOS going forward will narrow down as well. So tighter budgets with less options means that competition is going to be fiercer and managing risk will become paramount. So how do you manage risk in Apple Search Ads? How do you manage dozens of active campaigns and ad groups… and potentially hundreds-to-thousands of keywords?

Staying on top of your campaigns in Apple Search Ads just got a whole lot easier. Recently, Search Ads Maven released its new tool, scripted automation, to control and optimize Apple Search Ads. Scripted automation brings the ability to control almost any aspect of your time spent in Apple Search Ads and automate it so that you can react to changes quickly and reduce risk.

code block

Scripted automation goes beyond the current automation system because it “unboxes” the user to create or modify any task. For most rules, using the basic automation tool is still a great idea as basic tasks are very easy to set up. Yet, each rule needs to be created for each campaign or ad group separately. What if you wanted just one rule that could run for every campaign? That’s where scripted automation comes in.

Scripted automation is a system of triggers and actions you can use with a basic understanding of coding. If you do, think of triggers as basic SQL queries and actions being basic javascript. They can be as simple as one trigger for one action or you can nest triggers within each other for more complex rules. The best place to start is to break down your problem into what you want to have happen (action) with when it should take place (trigger).

For example, let’s say I wanted to make sure that if a campaign is performing poorly that I am able to pause it automatically. For the trigger, let’s say Cost-Per-Acquisition (CPA) when it’s greater than $10 and installs less than 25. As for the action, if those two things are true I want the campaign to be paused.

Pause Poorly Performing Campaigns

Trigger: campaign.cpa > 10 and campaign.installs > 25
Campaign Action: PauseCampaign(id)

Now we have a basic rule that you can apply to all campaigns and can run once daily or up to every few minutes. You can adjust those CPA or install values to your own specific app needs or even use your own formula like a ratio between them.

Now that we have a basic script, let’s think about expanding upon it and adding more triggers and actions. What if we could not only pause those poorly performing campaigns, but also transfer the budget from them to the better performing campaigns?

Reallocate Funds from Poorly Performing to Better Performing Campaigns

campaign.cpa > 10 and campaign.installs > 25 and campaign.spend < campaign.budget and campaign.state = "ACTIVE"

Here we have the same trigger from before but added in the extra qualifiers of where it’s spend is still below it’s budget and it is still an active campaign.

Campaign Action: PauseCampaign(id); SumCachedValue('reallocateBudget', budget - spend);

Now, we are pausing the campaign and creating a variable named “reallocateBudget” that is made of the remaining spend out of its budget.

campaign.cpa 10 and campaign.state = "ACTIVE"

So where are we going to find a good performing campaign? Let’s take all the campaigns that have a CPA less than or equal to 1 and also has at least 10 installs. Oh, and they have to be active as well.

ORDER BY campaign.cpa ASC

With this trigger, we take the higher performing campaigns from above and order them by CPA with the lowest CPA at the top.

SetCampaignBudget(id, SumCachedValue('reallocateBudget', budget)); StopAction();

Now, we take the extra budget from the action earlier and add it into the top performing campaign.

A little more complex but pretty understandable. The best part is, there are multiple ways I could have accomplished the same result. I can adjust variables or change triggers and still pause those bad campaigns and add their budget to good ones. There is so much potential with scripted automation to build out anything you can think up. To demonstrate it, let’s brainstorm an idea for using scripted automation in an A/B test.

For example, you could run multiple Ad Groups with different custom product pages, and through scripted automation disable the least-performant Ad Group, one by one, until only one remains. That would support more than just two scenarios like what you get in a traditional A/B test but is just an example of how it could be accomplished. Doing so wouldn’t require any additional functionality.

A/B test

First, create 10 different Ad Groups each with different custom product pages. You will want to do this first as automation cannot actually create categories or ad groups. Then, we create our rule which runs once per day and locates the least performant of the 10 Ad Groups and disables it. That would accomplish A/B testing in that it would determine the best performing ad group (custom product page) over some period of time.

If we take a quick stab at putting this together it may look something like this:

adgroup.name like ‘%cpp test%’ ORDER BY adgroup.cpa ASC

The first step gets all ad groups from the test group (in this case any ad group with “cpp test” in the name). Then, it orders them from best to worst performing with CPA being the variable we can use to judge performance.

if (index>0) {SetCachedValue(“worst_adgroup”, id); StopAction(); }

Next, we want to store the name of the ad group that is the worst performing.

PauseAdGroup(GetCachedValue(“worst_adgroup”,0))

Now, we pause that ad group.

You may have noticed the if() statement in step 2 which is just a clue in the power that you can get with some basic javascript knowledge although there is so much you can do without it.

Search Ads Maven is the premier Apple Search Ads tool to perform all of the necessary daily adjustments to your campaigns. Leave the block and tackle work to us so you can focus on strategy. For more information, check out our support documentation.

Start your year off right with scripted automation from Search Ads Maven and schedule a demo today, click here.