Script for Shopping that automatically adjusts Product Group Max CPC so it matches Benchmark Max CPC
function main() { var shoppingCampaignSelector = AdWordsApp.shoppingCampaigns() .withCondition("CampaignName ='INSERT_CAMPAIGN_NAME_HERE'"); var shoppingCampaignIterator = shoppingCampaignSelector.get(); while (shoppingCampaignIterator.hasNext()) { var shoppingCampaign = shoppingCampaignIterator.next(); var shoppingAdGroups = shoppingCampaign.adGroups().withCondition("Name = 'INSERT_AD_GROUP_NAME_HERE'"); var shoppingAdGroupsIterator = shoppingAdGroups.get(); while(shoppingAdGroupsIterator.hasNext()){ var shoppingAdGroup = shoppingAdGroupsIterator.next(); var pgs = shoppingAdGroup.productGroups().get(); //you may change this depending on your requirement while(pgs.hasNext()){ var pg = pgs.next(); var report = AdWordsApp.report( 'SELECT BenchmarkAverageMaxCpc ' + 'FROM PRODUCT_PARTITION_REPORT '+ 'WHERE Id = '+pg.getId()); var row = report.rows().next(); var benchmark = row['BenchmarkAverageMaxCpc']; pg.setMaxCpc(benchmark); } } } } Comments are closed.
|
Archives
December 2017
Categories
All
|