By adding as many locations as possible in your campaign, you gain more insight into the performance in the target area. That way you can make bid adjustments to reduce the cost per conversion in locations that are too expensive.

We also have scripts for bidadjustments for audiences, locations or adschedule. Start automating all of your bidadjustments today.

Settings

In the script you can only adjust the following things:

  • LOG: Specify whether the script should report the intermediate steps by adjusting the value to true.
  • DATE_RANGE: The script looks at the conversions and costs over this period.
  • EXCLUDE_LOCATIONS: Exclude locations from this scripts with location ID's. Add multiple location ID's with comma's separated. Find the ID's here: https://developers.google.com/adwords/api/docs/appendix/geotargeting

Scheduling: To generate sufficient data we advise to run the script once a week.

Script
// Copyright 2019. Increase BV. All Rights Reserved.
//
// Created By: Tibbe van Asten
// for Increase B.V.
// 
// Created: 20-07-2018
// Last update: 15-03-2019
//
// ABOUT THE SCRIPT
// With this script we adjust the biddings for locations in 
// active campaigns.
//
////////////////////////////////////////////////////////////////////

var config = {

  LOG : true,
  DATE_RANGE : "LAST_30_DAYS",
  
  // Add location ID's to skip from bidadjustments, comma seperated
  // Find location ID's: https://developers.google.com/adwords/api/docs/appendix/geotargeting
  EXCLUDE_LOCATIONS : ""
  
}

////////////////////////////////////////////////////////////////////

function main() {
    
  var locationIterator = AdsApp
    .targeting()
    .targetedLocations()
    .get();

  while(locationIterator.hasNext() && locationIterator.totalNumEntities() > 1) {
    var location = locationIterator.next();
    
    if(config.EXCLUDE_LOCATIONS !== "" && config.EXCLUDE_LOCATIONS.indexOf(location.getId()) >= 0){
      continue;
    }

    var locationCpa = location.getStatsFor(config.DATE_RANGE).getCost() / location.getStatsFor(config.DATE_RANGE).getConversions();
    var campaignCpa = location.getCampaign().getStatsFor(config.DATE_RANGE).getCost() / location.getCampaign().getStatsFor(config.DATE_RANGE).getConversions();
    var newLocationBid = campaignCpa / locationCpa;

    // If there is an location CPA, we will place a bidadjustment
    if(isNaN(newLocationBid) === false && isFinite(locationCpa) === true && location.getBidModifier() !== newLocationBid) {
      if(newLocationBid < 0.8) { newLocationBid = 0.58; }
      if(newLocationBid > 1.2) { newLocationBid = 1.2; }
      
      	if(config.LOG === true) {
          Logger.log("Campaign: " + location.getCampaign().getName());
          Logger.log("Location: " + location.getName()); 
          Logger.log("Location CPA: " + locationCpa);
          Logger.log("New location bid: " + newLocationBid);
        }  
      
      location.setBidModifier(newLocationBid);    
         
    }    

  } // location iterator      
  
} // function main()

Sharing knowledge

Adsscripts.com is all about sharing knowledge. In the current market, PPC specialists like to keep their knowledge and experience to themselves. We're convinced that sharing knowledge can ensure that everyone gets better at their work. We want to change this by sharing our knowledge about scripts with everyone.

Do you also want to contribute? We are open to new ideas and feedback on everything you find on Adsscripts.com.

Contact us

Nils Rooijmans
Google Ads Scripter
Water Cooler Topics
Nils Rooijmans, Google Ads Scripter
Bas Baudoin
Teamleader PPC
Happy Leads
Bas Baudoin, Teamleider SEA
Tibbe van Asten
PPC Specialist
Founder Adsscripts
Tibbe van Asten, Senior PPC Automation Specialist