Automação Google Ads: Anúncios Sazonais

Nessa série especial, reunimos alguns scripts úteis para você automatizar e aumentar o retorno de suas campanhas no Google Ads. Confira abaixo como automatizar o Google Ads para “Trabalhar com anúncios sazonais”.

 

1. Atualize Anúncios para o Ano Novo – Por Russel Savage. Tenha seus anúncios atualizados assim que o ano novo chegar. Esse script pode auxiliar anunciantes de empresas que precisem ter o ano em seus textos.

//———————————–
// Update Ads for 2012
// Created By: Russ Savage
// FreeAdWordsScripts.com
//———————————–
function main() {
var OLD_YEAR = “2011”;
var NEW_YEAR = “2012”;
//You probably shouldn’t update destination urls unless you know what you are doing.
var FIELDS_CONTAINING_YEAR = [“Headline”,”Description1″,
“Description2″,”DisplayUrl”
/*,”DestinationUrl”*/
];

for(i in FIELDS_CONTAINING_YEAR) {
var field_iter = AdWordsApp.ads()
.withCondition(FIELDS_CONTAINING_YEAR[i] + ” CONTAINS ” + OLD_YEAR)
.withCondition(“Status = ENABLED”)
.get();

_iterateThroughAds(field_iter);
}

//—————
// Private Helper Functions
//—————
function _iterateThroughAds(ad_iter) {
while (ad_iter.hasNext()) {
var ad = ad_iter.next();
var ag = ad.getAdGroup();
_createNewAdFromOldAd(ag,ad);
}
}

function _createNewAdFromOldAd(adgroup, old_ad) {
//get the updated ad texts replacing all the old years with the new years
var new_headline = old_ad.getHeadline().replace(OLD_YEAR,NEW_YEAR);
var new_desc1 = old_ad.getDescription1().replace(OLD_YEAR,NEW_YEAR);
var new_desc2 = old_ad.getDescription2().replace(OLD_YEAR,NEW_YEAR);
var new_display_url = old_ad.getDisplayUrl().replace(OLD_YEAR,NEW_YEAR);
var new_dest_url = old_ad.getDestinationUrl();/*.replace(OLD_YEAR,NEW_YEAR);*/

//now create the new ad and pause the old one.
adgroup.createTextAd(new_headline,new_desc1,new_desc2,new_display_url,new_dest_url);
old_ad.pause();
}
}

 

2. Atualize suas Palavras-chave em Feriados e Datas Comemorativas – Por Russel Savage. Todas as suas palavras-chave que tiverem o ano atual em seu texto será substituído com o ano atual. Assim, caso você não precisa mudar manualmente todas essas palavras-chave.

/*********************************************
* Update Keywords for the New Year
* Version 1.1
* Changelog v1.1
* – Updated for speed and added comments
* Created By: Russ Savage
* FreeAdWordsScripts.com
**********************************************/
function main() {
var sameDayLastYear = new Date();
sameDayLastYear.setYear(sameDayLastYear.getYear()-1);
var oldYearStr = sameDayLastYear.getYear().toString();
var newYearStr = new Date().getYear().toString();

Logger.log(‘Updating keywords with old year: ‘+oldYearStr+’ to new year: ‘+newYearStr);

// Let’s start by getting all of the keywords
var kwIter = AdWordsApp.keywords()
.withCondition(“Text CONTAINS ” + oldYearStr)
.withCondition(“Status = ENABLED”)
.withCondition(“AdGroupStatus = ENABLED”)
.withCondition(“CampaignStatus = ENABLED”)
.get();

// It is always better to store and batch process afterwards
var toPause = [];
var toCreate = [];
while (kwIter.hasNext()) {
var kw = kwIter.next();
var ag = kw.getAdGroup();
var oldText = kw.getText();
var newText = oldText.replace(oldYearStr,newYearStr);
// Save the info so that we can create them as a batch later
toCreate.push({ ag: ag, text: newText, cpc:kw.getMaxCpc(), destUrl : kw.getDestinationUrl() });
// Same with the ones we want to pause
toPause.push(kw)
}
// Now we create the new keywords all at once
for(var i in toCreate) {
var elem = toCreate[i];
elem.ag.createKeyword(elem.text, elem.cpc, elem.destUrl);
}
// And pause the old ones all at once
for(var i in toPause) {
toPause[i].pause();
//or toPause[i].remove(); to delete the old keyword
}
}