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

Script To Pause Campaigns At Daily Budget - Shopping Campaign Is Remaining Enabled

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi AdWordsers,

 

I'm using the following script to pause my enabled campaigns when a total daily budget is reached:

Screen Shot 2017-02-13 at 3.03.06 PM.png

The problem is, there is a shopping campaign that should be included in there that I would like to be paused. However, it never successfully gets paused while all the other search and display campaigns do.

 

Any one see anything missing from the code or have any thoughts as to why?

 

Thanks!

2 Expert replyverified_user

Script To Pause Campaigns At Daily Budget - Shopping Campaign Is Remaining Enabled

Eva Rising Star
Rising Star
# 2
Eva Rising Star
Rising Star

Hi @Sarah B

 

As Shopping campaigns have a different structure from the regular Adwords campaign, you'll have to adjust your script.

 

You may read the solution here https://www.en.advertisercommunity.com/t5/Advanced-Features/Help-with-Pause-Enable-Campaign-by-Date-....

Regards,
Eva
Marked as Best Answer.
Solution
Accepted by topic author Sarah B
February 2017

Script To Pause Campaigns At Daily Budget - Shopping Campaign Is Remaining Enabled

[ Edited ]
Top Contributor
# 3
Top Contributor

Hi, Sarah.

 

Shopping campaigns are a different object in AdWords Scripts. So, beside looping through regular campaigns and pausing them, you need to do the same with shopping campaigns.

 

If you add the following lines inside the if (totalCost > 25) loop you should be fine:

 

var shoppingCampaignIterator = AdWordsApp.shoppingCampaigns().withCondition("Status = ENABLED").get();
while (shoppingCampaignIterator.hasNext()) {
var shoppingCampaign = shoppingCampaignIterator.next();
shoppingCampaign.pause();
}

 

 

 

Hope it helps.

Calin Sandici, AdWords Top Contributor | Find me on: Google+ | Twitter | LinkedIn | myBlog
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here.

Script To Pause Campaigns At Daily Budget - Shopping Campaign Is Remaining Enabled

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

Worked perfectly. Thanks @AdWiser !

Script To Pause Campaigns At Daily Budget - Shopping Campaign Is Remaining Enabled

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hello everyone,

 

I want to use the same adwords script but when I press the Preview button, it displays "Syntax error. (line 18)" (please see the screenshot http://prnt.sc/ez6azz).

 

Do you have any idea why ?

 

Thank you.

 

Have a nice day!