AdWords
4.5K members online now
4.5K members online now
Dive into advanced features like Remarketing, Flexible Bid Strategies, AdWords Editor, and AdWords Scripts
Guide Me
star_border
Reply

Automated Rule - Pause if account's sum impressions is reached

J M
Follower ✭ ☆ ☆
# 1
J M
Follower ✭ ☆ ☆

Hello, automated rules are great, but I can't seem to find a way to set up a rule that will shutoff all campaigns within an account (we run off a MCC) when the TOTAL number of impressions across ALL campaigns reaches a certain goal.

 

Example:

Total program goal of 100,000 impressions.

 

Keyword Campaign

Retargeting Campaign

Behavioral Campaign

---------------------------------------------

100,000 impressions total across all 3 campaigns

 

Basically, is there a rule that factors in an account's sum impressions? This would be very useful and I can't seem to find anything! Thanks!

1 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author J M
September 2015

Re: Automated Rule - Pause if account's sum impressions is reached

Top Contributor
# 6
Top Contributor

Hi J M happy to help.  Please make sure you read and understand the notes here about using Scripts, particularly about how to Preview it to make sure it does what you want.  Neither I, nor Google, accept any responsibility for any unexpected or unwanted changes as a result of running this script.

 

In the example I've given (down the bottom of this post), simply change the value for MAX_IMPRESSIONS to whatever you need and the TIME_PERIOD to whatever that needs to be (for example, ALL TIME, LAST_7_DAYS, etc.), then schedule the script to run once a day, or maybe more often (depending upon how vital it is that the impressions are exactly matched) and you should be good to go.

 

For previewing purposes, I'd suggest setting the MAX_IMPRESSIONS to something you know will trigger the pause - don't worry, previewing doesn't actually carry out the changes - and check the Log screen to see which Campaigns would be paused.  If that looks good, change the figure to what it should be.

 

Any problems, shout.

 

Jon

 

//*** script begins below ***

 

var MAX_IMPRESSIONS = 100;
var TIME_PERIOD = "THIS_MONTH";

function main() {
var campaigns = AdWordsApp.campaigns()
.withCondition("Status = 'ENABLED'")
.get();
var totalImpressions = 0;
while(campaigns.hasNext()) {
var thisCampaign = campaigns.next();
var thisStats = thisCampaign.getStatsFor(TIME_PERIOD);
var thisImps = thisStats.getImpressions();

totalImpressions += thisImps;
}
Logger.log(totalImpressions);
if(totalImpressions > MAX_IMPRESSIONS) {
var campaignsToPause = AdWordsApp.campaigns()
.withCondition("Status = 'ENABLED'")
.get();
while(campaignsToPause.hasNext()) {
var pauseCampaign = campaignsToPause.next();
pauseCampaign.pause();
Logger.log(pauseCampaign.getName());
}
}
}

 

//***script ends***

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

View solution in original post

Re: Automated Rule - Pause if account's sum impressions is reached

Top Contributor
# 2
Top Contributor

Hi J M, no, sorry, that's not possible with Automated Rules - even at the MCC level.  Rules don't work well when you want to combine more than one element.


The good news is that it's relatively easy to do with a Script.  Do you have any experience with Scripts?

 

Jon

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Automated Rule - Pause if account's sum impressions is reached

J M
Follower ✭ ☆ ☆
# 3
J M
Follower ✭ ☆ ☆
Thanks for the quick reply! But unfortunately, I have never been exposed to scripting. I am very tech savvy individual.. is there a way to get caught up to the point I can at least set up one for this specific need?

Re: Automated Rule - Pause if account's sum impressions is reached

Top Contributor
# 4
Top Contributor
Give me half-an-hour or so J M and I'll give you the bare bones that you should be able to adapt as you need.

Jon
AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Automated Rule - Pause if account's sum impressions is reached

J M
Follower ✭ ☆ ☆
# 5
J M
Follower ✭ ☆ ☆
You are a great person. I genuinely appreciate it. Thanks so much!
Marked as Best Answer.
Solution
Accepted by topic author J M
September 2015

Re: Automated Rule - Pause if account's sum impressions is reached

Top Contributor
# 6
Top Contributor

Hi J M happy to help.  Please make sure you read and understand the notes here about using Scripts, particularly about how to Preview it to make sure it does what you want.  Neither I, nor Google, accept any responsibility for any unexpected or unwanted changes as a result of running this script.

 

In the example I've given (down the bottom of this post), simply change the value for MAX_IMPRESSIONS to whatever you need and the TIME_PERIOD to whatever that needs to be (for example, ALL TIME, LAST_7_DAYS, etc.), then schedule the script to run once a day, or maybe more often (depending upon how vital it is that the impressions are exactly matched) and you should be good to go.

 

For previewing purposes, I'd suggest setting the MAX_IMPRESSIONS to something you know will trigger the pause - don't worry, previewing doesn't actually carry out the changes - and check the Log screen to see which Campaigns would be paused.  If that looks good, change the figure to what it should be.

 

Any problems, shout.

 

Jon

 

//*** script begins below ***

 

var MAX_IMPRESSIONS = 100;
var TIME_PERIOD = "THIS_MONTH";

function main() {
var campaigns = AdWordsApp.campaigns()
.withCondition("Status = 'ENABLED'")
.get();
var totalImpressions = 0;
while(campaigns.hasNext()) {
var thisCampaign = campaigns.next();
var thisStats = thisCampaign.getStatsFor(TIME_PERIOD);
var thisImps = thisStats.getImpressions();

totalImpressions += thisImps;
}
Logger.log(totalImpressions);
if(totalImpressions > MAX_IMPRESSIONS) {
var campaignsToPause = AdWordsApp.campaigns()
.withCondition("Status = 'ENABLED'")
.get();
while(campaignsToPause.hasNext()) {
var pauseCampaign = campaignsToPause.next();
pauseCampaign.pause();
Logger.log(pauseCampaign.getName());
}
}
}

 

//***script ends***

AdWords Top Contributor Google+ Profile | Partner Profile | AdWords Audits

Re: Automated Rule - Pause if account's sum impressions is reached

Participant ✭ ✭ ✭
# 7
Participant ✭ ✭ ✭
Hi JM

The solution which @Jon_Gritton provided is the best and i think easiest way in your case, but i also want to have my idea posted, may be someone else may find it useful.

As you have mentioned that you have 3 campaigns and you want to pause them when sum of their impressions reaches 100,000. Now if all three campaign are getting approximately equal impressions then you can create a rule and apply to all campaigns to pause them when each of them reaches 33,000 impressions. This will pause the campaigns when each of them reaches 33,000 impressions in a day.
Secondly, if your campaigns are getting unequal number of impressions i.e. campaign 1 is getting 80,000 impression, campaign 2 is getting 45,000 and campaign 3 is getting 25,000 impressions after taking from monthly average in a day(these are just assumption), then here you need to have do some calculation. Create 3 different rules for each campaign and take a percentage of impressions for all three campaigns like if we take 70% of each campaign then the total number of impressions would be (56,000+31,500+17,500) around 105,000 which somewhere near to your requirement.
I know this is kind of addition, multiplication and can be irritating to do, but if you want to use automated rules then it may help.

Hope this make sense!

Abhishek