Hey Google Ads Scripts Forum,
I have 2 questions that I hope you can help me with:
1)
I
just setup the script below to automatically increase
our Max CPC for products with the custom label value = x in our shopping
campaigns.
function main() {
var shoppingCampaignSelector = AdWordsApp.shoppingCampaigns();
var shoppingCampaignIterator = shoppingCampaignSelector.get();
while (shoppingCampaignIterator.hasNext()) {
var shoppingCampaign = shoppingCampaignIterator.next();
var shoppingAdGroups = shoppingCampaign.adGroups();
var shoppingAdGroupsIterator = shoppingAdGroups.get();
while(shoppingAdGroupsIterator.hasNext()){
var shoppingAdGroup = shoppingAdGroupsIterator.next();
var pgs = shoppingAdGroup.productGroups().get();
while(pgs.hasNext()){
var pg = pgs.next();
Logger.log(pg.getDimension());
if (pg.getDimension() == 'CUSTOM_LABEL'){ //if the product dimension is a custom label
Logger.log("Custom Label: %s",pg.asCustomLabel().getValue());
if (pg.asCustomLabel().getValue() == 'x'){ //custom label is x
pg.asItemId().setMaxCpc(pg.asItemId().getMaxCpc()*1.50); //increases or decreases the bid by the multiplier
Logger.log("Changed CPC to %s",pg.asItemId().getMaxCpc());
}
else if (pg.asCustomLabel().getValue() == 'y'){
pg.asItemId().setMaxCpc(pg.asItemId().getMaxCpc()*0.80); //increases or decreases the bid by the multiplier
Logger.log("Changed CPC to %s",pg.asItemId().getMaxCpc());
}
}
}
}
}
}
I just realized that this script
doesn't work as it is ment to. My plan was to run it once a day, so that
it automatically increases the bids for new products where we have added the custom label = x in a Google
supplemental feed. But that way it also keeps on increasing the bids for the
products that already have the custom label value x. The bids should
only be increased once for all products with custom label x.
Can I somehow use the max CPC for the "Everything else" products (the other products in this product group) in this line (23):
pg.asItemId().setMaxCpc(pg.asItemId().getMaxCpc()*1.50);
If
I could do that, then the script will not keep on increasing the bids
more and more everytime it runs, because the max CPC for "Everything
else" stays the same :-)
2)
The
script is setup to run on a single Google Ads account. Can I modify the
script to run on a MCC account so that I only have to maintain the
script in one place? It should probably use the
executeInParallel method (we have about 20 different Google Ads
accounts).
My biggest concern is to fix the first issue, but if you could also help me with the second one that would be really great.
Thank you.