Manage all of your mobile & tablet bid adjustments via a Google Spreadsheet with this simple but effective AdWords Script.

It’s possible to update bids in bulk within AdWords, but using a google Spreadsheet has a few advantages:

  • Speed. Spreadsheets can be updated very quickly, a big time saver for larger accounts
  • Schedule changes. When changes are made at a random time during the day, any future comparisons are inaccurate for that day. Schedule the script to run at midnight to avoid inaccurate data
  • Flexibility. Spreadsheets provide so much ease and flexibility. It’s possible, for example, to link to external data to update bids from a simple copy & paste (recommended, or better yet use another script to calculate the modifiers for you)
  • Shareability. Sheets allow team access to information and (if you like) the ability to edit modifiers without needing to use AdWords itself

Tip: Set the script to run at midnight for clean-cut data, changing at a random time during the day can make comparisons less accurate

adwords script device modifiers

Setup

  1. Make a copy of this Google Spreadsheet and add your mobile and tablet modifier details
  2. Make a copy of the script, adding your spreadsheet URL and sheet name to the top of the sheet. See “sheet URL here” and “sheet name here”.
  3. By setting to run daily, mobile and tablet bid modifiers can be completely controlled via a Google Spreadsheet

 

/**
* AutomatingAdWords.com - Set Mobile  & Tablet Bids from Sheet
*
* Go to automatingadwords.com for installation instructions & advice
*
* Version: 1.1
**/
//Spreadsheet URL here
var SPREADSHEET_URL = "https://docs.google.com/spreadsheets/d/1YX9a7_bK2hQoAyJDQ1t85N0ki8ledni6xfVyP7cUKdA/edit#gid=0";
//Sheet (tab) name here
var SHEET_NAME = "Device Bids";

var ss = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet = ss.getSheetByName(SHEET_NAME);
function main() {
  var row = 2;
  while(sheet.getRange(row, 1).getValue()){
    var campaignName = sheet.getRange(row, 1).getValue();
    var mobileMod = sheet.getRange(row, 3).getValue();
    var tabletMod = sheet.getRange(row, 4).getValue();
    if(sheet.getRange(row, 2).getValue()){
      
      var adGroupName = sheet.getRange(row, 2).getValue();
      Logger.log("adgroup level" + adGroupName);
     var adgroup = AdWordsApp.adGroups()
     .withCondition("Name = '"+ adGroupName +"'")
     .withCondition("CampaignName = '"+ campaignName +"'")
     .get();
      if(adgroup.hasNext()){
      adgroup.next().devices().setMobileBidModifier(1+mobileMod);
      }
      if(adgroup.hasNext()){
        adgroup.next().devices().setTabletBidModifier(1+tabletMod);
      }
    }else{
      Logger.log("campaign level: " + campaignName);
     var campaigns = AdWordsApp.campaigns().withCondition("CampaignName = '"+ campaignName +"'").get();
      if(campaigns.hasNext()){
        var campaignTargets = campaigns.next().targeting().platforms().get();
      }
      while(campaignTargets.hasNext()){
      var campaignTarget = campaignTargets.next();
      if(campaignTarget.getName()=="HighEndMobile"){
        campaignTarget.setBidModifier(1+mobileMod);
      }else if(campaignTarget.getName()=="Tablet"){
        campaignTarget.setBidModifier(1+tabletMod);
      }
      }
    }
    row++;
  }
  
  
  var row = 2;
  while(sheet.getRange(row, 1).getValue()){
    var campaignName = sheet.getRange(row, 1).getValue();
    var mobileMod = sheet.getRange(row, 3).getValue();
    var tabletMod = sheet.getRange(row, 4).getValue();
    if(sheet.getRange(row, 2).getValue()){
      
      var adGroupName = sheet.getRange(row, 2).getValue();
      Logger.log("adgroup level" + adGroupName);
     var adgroup = AdWordsApp.shoppingAdGroups()
     .withCondition("Name = '"+ adGroupName +"'")
     .withCondition("CampaignName = '"+ campaignName +"'")
     .get();
      if(adgroup.hasNext()){
      adgroup.next().devices().setMobileBidModifier(1+mobileMod);
      }
      if(adgroup.hasNext()){
        adgroup.next().devices().setTabletBidModifier(1+tabletMod);
      }
    }else{
      Logger.log("campaign level: " + campaignName);
     var campaigns = AdWordsApp.shoppingCampaigns().withCondition("CampaignName = '"+ campaignName +"'").get();
      if(campaigns.hasNext()){
        var campaignTargets = campaigns.next().targeting().platforms().get();
      }
      while(campaignTargets.hasNext()){
      var campaignTarget = campaignTargets.next();
      if(campaignTarget.getName()=="HighEndMobile"){
        campaignTarget.setBidModifier(1+mobileMod);
      }else if(campaignTarget.getName()=="Tablet"){
        campaignTarget.setBidModifier(1+tabletMod);
      }
      }
    }
    row++;
  }
  
  
}

7 Comments

Mitch · January 29, 2018 at 8:08 pm

I tried running this, but it will only update the mobile bids, it won’t change any of the tablet bids.

    Automating AdWords · October 23, 2018 at 5:59 pm

    Hi Mitch,
    I’m really sorry for the ridiculous delay on this one! Your message slipped through the net.
    Unsure if you’re still looking for an answer, but I’ll double check this is working and get back to you.
    Thanks – and sorry again!
    Charles

Rakesh Shaw · October 23, 2018 at 2:27 pm

Hi,
Hope you are well,
I am very excited after reading this post. I want to add campaign name and adgroup name in this spreadsheet. Could you please suggest me how to use this?

Thanks.

    Automating AdWords · October 23, 2018 at 6:01 pm

    Hi Rakesh,
    It’s already setup to accept both an adgroup and campaign name. Maybe I’m not following?
    Thanks

Jonny · October 30, 2018 at 2:24 pm

Is there any way this could be edited to make updates hourly, similar to the 24hr bidding script?

    Automating AdWords · November 1, 2018 at 6:24 pm

    Hi Jonny,
    The 24h bidding script already updates mobile bids hourly however, as far as I’m aware doesn’t include tablet bids.
    I assume you’d need the bid adjustments themselves to update based on performance too?
    Thanks

Kristina · November 29, 2018 at 8:18 pm

Can the template and script be updated so that you can also update desktop bid modifiers?

Leave a Reply to Kristina Cancel reply

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