function main() { // Target Locations (Adjust this list!) var targetLocations = [ "California", "New York", "Texas" ]; // Bid Adjustments (Positive = Increase, Negative = Decrease) var locationBidModifiers = { "California": 0.20, // Increase bids by 20% in California "New York": 0.10, // Increase bids by 10% in New York "Texas": -0.15 // Decrease bids by 15% in Texas }; // Campaign Selection var campaignName = "Campaign Name"; // Get all the location criteria within the specified campaign var locationIterator = AdsApp.campaigns() .withCondition("Name = '" + campaignName + "'") .get() .targeting().locations(); while (locationIterator.hasNext()) { var location = locationIterator.next(); var locationName = location.getName(); // Check if the location is in our target list if (targetLocations.indexOf(locationName) !== -1) { var bidModifier = locationBidModifiers[locationName]; // Set the bid modifier only if it exists if (bidModifier) { location.setBidModifier(1 + bidModifier); } } } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter