ISO - Script for pausing shopping adgroups on threshold

36 views
Skip to first unread message

dou...@meatprocessingproducts.com

unread,
Jan 23, 2019, 11:51:10 AM1/23/19
to Google Ads Scripts Forum

I am looking for a script to pause new testing adgroups within a specific campaign. Example. Pause every adgroups in "this" campaign when adgroup cost is over "this", create label upon pause.


dou...@meatprocessingproducts.com

unread,
Jan 23, 2019, 11:52:08 AM1/23/19
to Google Ads Scripts Forum
Might I add this is for shopping campaigns.

googleadsscrip...@google.com

unread,
Jan 23, 2019, 1:27:40 PM1/23/19
to adwords-scripts+apn2wqf29yqwnlug...@googlegroups.com
Hello,

I would recommend having a look at these useful shopping-specific code snippets. For example, you could modify and add lines of this snippet to the code below:

function getShoppingAdGroup() {
  
var campaignName = 'INSERT_CAMPAIGN_NAME_HERE';
  
var adGroupName = 'INSERT_ADGROUP_NAME_HERE';


  
var adGroupIterator = AdsApp.shoppingAdGroups()
      
.withCondition("CampaignName = '" + campaignName +
          
"' and AdGroupName = '" + adGroupName + "'")
      
.get();
  
while (adGroupIterator.hasNext()) {
    
var adGroup = adGroupIterator.next();
    var adGroupCost = adGroup.getStatsFor("TODAY").getCost(); //Insert your date range
    
if(adGroupCost > 100) { // Insert your own cost threshold
      adGroup
.pause();
      adGroup
.applyLabel("Paused"); //Use your label

    
}
  
}
}

You can find more snippets for other Scripts entities here.

Regards,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/16558f8f-4be9-40a8-980b-9e4b117840b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dou...@meatprocessingproducts.com

unread,
Jan 23, 2019, 1:48:27 PM1/23/19
to Google Ads Scripts Forum
I do not need to call a specific adgroup, just the campaign. Need to script to find the adgroups with cost above x and pause and label. I tried modifying this and testing on a campaign that falls into our param, with no result on preview.


On Wednesday, January 23, 2019 at 10:51:10 AM UTC-6, (unknown) wrote:

googleadsscrip...@google.com

unread,
Jan 23, 2019, 3:18:50 PM1/23/19
to adwords-scripts+apn2wqf29yqwnlug...@googlegroups.com, Google Ads Scripts Forum
Hello,

In that case, you can delete the line:

  var adGroupName = 'INSERT_ADGROUP_NAME_HERE';

and modify the selector condition to:

  .withCondition("CampaignName = '" + campaignName)

If you continue to have issues, please post the code that you are running and any relevant screenshots.

Regards,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.

dou...@meatprocessingproducts.com

unread,
Jan 23, 2019, 3:23:42 PM1/23/19
to Google Ads Scripts Forum
Thanks for your assistance, I built something similar to this a week ago playing around, but it resulted with no changes.


function main() {
 

function getShoppingAdGroup() {
 
var campaignName = 'Shopping: Shopping - Google Group0';

 
var adGroupIterator = AdsApp.shoppingAdGroups()

 
.withCondition("CampaignName = '" + campaignName)

 
.get();
 
while (adGroupIterator.hasNext()) {
   
var adGroup = adGroupIterator.next();
   
var adGroupCost = adGroup.getStatsFor("TODAY").getCost(); //Insert your date range

   
if(adGroupCost > 2) { // Insert your own cost threshold

dou...@meatprocessingproducts.com

unread,
Jan 23, 2019, 3:40:09 PM1/23/19
to Google Ads Scripts Forum
Still coming back as no results when we have spent more than the 2.00 testing threshold.

googleadsscrip...@google.com

unread,
Jan 24, 2019, 3:20:19 PM1/24/19
to adwords-scripts+apn2wqf29yqwnlug...@googlegroups.com, Google Ads Scripts Forum
Hello,

Can you please privately reply with your CID and the name of the script so I can investigate further?

Thanks,
Matt
Google Ads Scripts Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_scripts
    https://developers.google.com/google-ads/scripts/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-scripts+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages