Home / All Articles / How to exclude multiple zip code from adWords campaigns via script code and applied on account for all campaign?

How to exclude multiple zip code from adWords campaigns via script code and applied on account for all campaign?

Whole code CTRL+C and go to the editor and press CTRL + A after CTRL+V

 


function main() {
getAllCampaigns();
}
function getAllCampaigns() {
// AdsApp.campaigns() will return all campaigns that are not removed by
// default.
var campaignIterator = AdsApp.campaigns().get();
Logger.log('Total campaigns found : ' +
campaignIterator.totalNumEntities());
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
Logger.log(campaign.getName());


// Exclude Tennessee, United States (location id = 21175) See
// https://developers.google.com/adwords/api/docs/appendix/geotargeting
// for list of all supported geo codes.
// You could pass either the location code, or a TargetedLocation or
// ExcludedLocation object from an existing campaign.
var zipcode_ides =[9013072,9013073,9013074];
//var tennessee_id = 21175;
zipcode_ides.forEach(function(val){
Logger.log(val);
campaign.excludeLocation(val);
//var sushil = campaign.excludeLocation(val);
// Logger.log(sushil);
});

}
}

After you will see the output like this

About admin

Check Also

Next.js is a framework built on top of React and Node.js, offering several advantages over using React and Node.js separately

Simplified Setup: React.js requires manual configuration for features like server-side rendering (SSR), routing, and code …

Leave a Reply

Your email address will not be published. Required fields are marked *