Skip to content

Instantly share code, notes, and snippets.

@soeirosantos
Last active August 29, 2015 14:19
Show Gist options
  • Save soeirosantos/7c45d297c116b4c141d3 to your computer and use it in GitHub Desktop.
Save soeirosantos/7c45d297c116b4c141d3 to your computer and use it in GitHub Desktop.
Script da API do Google Ad Words que coloca um rótulo em todas as keywords que se aplicam a um determinado filtro.
function main() {
var IMPRESSIONS = 10;
var CTR = 0.01;
//var AVG_CPC = 2.00;
var keywords = AdWordsApp.keywords().
withCondition('CampaignStatus = ENABLED').
withCondition('AdGroupStatus = ENABLED').
withCondition('Status = ENABLED').
withCondition('Ctr > ' + CTR).
withCondition('Impressions > ' + IMPRESSIONS).
//withCondition('AverageCpc > ' + AVG_CPC).
forDateRange('LAST_30_DAYS').
get();
while (keywords.hasNext()) {
var keyword = keywords.next();
Logger.log('Aplicando rotulo em: ' + keyword.getText());
//ATENCAO: O marcador precisa ser criado previamente.
keyword.applyLabel('hot');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment