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

Help with Pause / Enable Campaign by Date or Day - Script

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Afternnon all, 

 
I'm 99% sure this is possible but I'm struggling to find anything regarding day/date functions..
 
I'm after a script that will allow me to pause  / enable a campaign (selected by campaign label) by day or date array
 
 
this might seem a little odd, but its basically to spread costs, id like to be able to pause certain campaigns with a specific label every other day or selected days (ie Tuesday, Thursday, Saturday.. even Sunday)
 
then i need the same script to reverse the paused campaigns and make them enabled on the other days or selected days (ie, Monday, Wednesday, Friday.. or Sunday)
 
 
please can someone help.
2 Expert replyverified_user
1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Richard H
September 2015

Re: Help with Pause / Enable Campaign by Date or Day - Script

Top Contributor
# 6
Top Contributor

Hi Richard,

 

Unfortunately Scripts treat Shopping Campaigns differently from "ordinary" Campaigns and the methods are different for referencing them.  Worse, they don't follow the same structure as ordinary Campaigns but rather work on the concept of "levels", which means any code addressing them needs to be specific to Shopping Campaigns.

 

It doesn't look like there's a method for the label object to retrieve them, so you'll need to select the Campaigns as follows instead:

 

var shpCampaigns = AdWordsApp.shoppingCampaigns()

  .withCondition("LabelNames CONTAINS 'VANITY_CAMPAIGNS'")

  .get();

 

then iterate the Campaigns for your code.

 

while (shpCampaigns.hasNext()) {

  var thisCampaign = shpCampaigns.next();

 

  // ... do stuff

}

 

Fortunately, since you're only working at the Campaign level you shouldn't need to get involved with Shopping's rather odd levels system...

 

Jon

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

View solution in original post

Re: Help with Pause / Enable Campaign by Date or Day - Script

Top Contributor
# 2
Top Contributor
HI Richard,

While I completely agree that a script can do this, I don't have the chops to provide you one. That said, and I'm sure you considered this, would ad scheduling help at all? You could just schedule certain campaigns to run on certain days.

-Tommy
Tommy Sands, AdWords Top Contributor | Community Profile | Twitter | Philly Marketing Labs
Did you find any helpful responses or answers to your query? If yes, please mark it as the ‘Best Answer.’

Re: Help with Pause / Enable Campaign by Date or Day - Script

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Tommy,

I did look at scheduling as this is the obvious option, however our scheduling is very complex and spans over a large number of campaigns..

my reason for looking at a script is due to it being a 1-off occurrence, or maybe the odd time in the future so to change a large number of schedules would be a pain in the a$$..

Re: Help with Pause / Enable Campaign by Date or Day - Script

Top Contributor
# 4
Top Contributor

Hi Richard, yes, scripts are the way forward with this.  A while back I wrote something a little similar where the requirement was to change the daily budget for numerous Campaigns based upon day of the month.  The script used a Docs spreadsheet that the client could edit simply.

 

It wouldn't be too hard to use a similar process for enabling/pausing Campaigns via an external sheet.  Essentially, the script would run every hour and iterate through the eligible Campaigns then lookup the sheet data to check whether that Campaign should be running at that hour/day.  If it's supposed to be paused, if it's already paused it moves on to the next Campaign, if it's not, it pauses it.

 

If the objective is to spread cost, have you considered other methods of doing this?  Are you tracking conversions, for example?  You could also use Scripts to assign a limited budget to the days/Campaigns that exhibit the best performance based upon historical data.

 

Jon

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

Re: Help with Pause / Enable Campaign by Date or Day - Script

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
Hi Jon,

Hope you had a good weekend...

With these particular Campaigns, we class them as "vanity campaigns" as they need to be there for visibility and they make a little more than they spend..

Over the weekend ive been playing around with a script after finding the javascript solution to finding the day, but for some reason its only pulling "Search" campaigns, not Search and Shopping..

Eg.

function main() {
var label = AdWordsApp.labels()
.withCondition('Name = "VANITY_CAMPAIGNS"')
.get().next();
var campaigns = label.campaigns().get();
var today = new Date().getDay();

while (campaigns.hasNext()) {
var campaign = campaigns.next();

// Additional code goes here..

}
}
Marked as Best Answer.
Solution
Accepted by topic author Richard H
September 2015

Re: Help with Pause / Enable Campaign by Date or Day - Script

Top Contributor
# 6
Top Contributor

Hi Richard,

 

Unfortunately Scripts treat Shopping Campaigns differently from "ordinary" Campaigns and the methods are different for referencing them.  Worse, they don't follow the same structure as ordinary Campaigns but rather work on the concept of "levels", which means any code addressing them needs to be specific to Shopping Campaigns.

 

It doesn't look like there's a method for the label object to retrieve them, so you'll need to select the Campaigns as follows instead:

 

var shpCampaigns = AdWordsApp.shoppingCampaigns()

  .withCondition("LabelNames CONTAINS 'VANITY_CAMPAIGNS'")

  .get();

 

then iterate the Campaigns for your code.

 

while (shpCampaigns.hasNext()) {

  var thisCampaign = shpCampaigns.next();

 

  // ... do stuff

}

 

Fortunately, since you're only working at the Campaign level you shouldn't need to get involved with Shopping's rather odd levels system...

 

Jon

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