Skip to content

Instantly share code, notes, and snippets.

@simeonpashley
Last active July 17, 2018 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simeonpashley/d1739527bff352f2364b7330bb7514bc to your computer and use it in GitHub Desktop.
Save simeonpashley/d1739527bff352f2364b7330bb7514bc to your computer and use it in GitHub Desktop.
AdWords Shopping Bidder - CPA Target £20
function main() {
var targetCPA = 20;
var productGroupSelector = AdWordsApp
.productGroups()
.withCondition("Impressions > 100")
.forDateRange("LAST_MONTH")
.orderBy("Clicks DESC");
var productGroupIterator = productGroupSelector.get();
while (productGroupIterator.hasNext()) {
var productGroup = productGroupIterator.next();
var conversionRate = productGroup.getStatsFor("LAST_MONTH").getConversionRate();
productGroup.setMaxCpc(targetCPA * conversionRate)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment