KeywordCostshutterstock_122697928Cropped

How To Use Scripts To Analyze AdWords Bid Headroom

1 comment

Companies of all sizes and within practically every industry have discovered that Google AdWords can considerably boost the visibility of a brand without wreaking havoc on company finances. Since marketing in essence is all about increasing customer or client base in the most cost-efficient manner, Google AdWords is quite a valuable marketing tool.

But like all tools, in order to be truly effective, it must be wielded the proper way; that’s where AdWords scripts come in. Carefully constructed AdWords scripts can allow a company to take full advantage of all the features and capabilities of AdWords and thus optimize their profits.

The Benefits of Using AdWords Scripts

AdWords scripts (Google’s extensive information on using scripts is located here) provide access to a specific AdWords account through a program called JavaScript. It’s important for business marketers to consistently use the most effective AdWords script campaigns available in order to increase campaign performance. Properly executed AdWords scripts can:

  • Be automated to run according to a particular time schedule
  • Be integrated with external data sources like email, spreadsheets, and URLs
  • Send notifications through email when certain parameters are met
  • Create detailed and comprehensive performance reports

The above are just a few examples of how AdWords scripts give marketers incredible flexibility within company AdWords accounts. AdWords scripts basically allow businesses to be more active players in their own marketing campaigns.

Bid Headroom: Analyzing Position 1 With AdWords Scripts

Bid headroom is a term that delineates the difference between your maximum and average cost per click. This value is important because the larger the gap between your maximum and average, the less control you will have over your total expenditure.

Using Headroom Analysis to Improve Bidding

The exact bid headroom for an account can be fairly easily calculated — simply subtract the average cost-per-click from bids for keywords where the maximum bids have historically been higher than your CPCs. Marketers can then average out the headroom for position 1 keywords more effectively. By knowing the gap between maximum bid and average CPC, a marketer’s PPC budget can be controlled much more effectively.

Unless you want to torture yourself unnecessarily by laboriously attempting to identify these values on your own, the Position 1 Bid Headroom script at the end of this post can be a huge time-saver. This script will make the necessary calculations for you and — like all AdWords scripts — it can be automated to run periodically according to unique account needs. Incorporating a script to identify top position bid headroom can significantly improve control over costs and resolve high cost-per-acquisition issues.

Position 1 Bid Headroom Script as a Solution

For instance, if a company’s competitor elects to use an aggressive bidding strategy, this could cause that company’s average CPCs to sharply increase. This will set off a cascade of negative effects in your PPC account overall, one of which is an over-inflated cost per acquisition. The position 1 bid headroom AdWords script can help keep the discrepancy between your maximum and average costs in check. The image below shows the location in AdWords where scripts you have available can be uploaded to your AdWords account within the Bulk Operations section of the Campaigns tab.

adwords-script

When set up and managed properly, AdWords campaigns can help businesses grow enormously. By positioning keywords correctly in an AdWords script, ROI goals can be met and profits maximized. Adwords scripts, like the Position 1 Bid Headroom Script below, allow businesses to exert optimal control over their accounts, which in turn maximizes profits.

var spreadsheet_url = "ENTER GOOGLE DOCS SPREADSHEET URL";
var RECIPIENT_EMAIL = "ENTER YOUR EMAIL ADDRESS";

function main() {

	var maxCPC = 0;
	var avgCPC = 0;
	var diff = 0;
	var row = 0;

	var spreadsheet = getSpreadsheet(spreadsheet_url);		

	//Get Sheets 
	var sheet = spreadsheet.getActiveSheet();
	sheet.clear();

	sheet.getRange("A1").setValue("Keyword");
	sheet.getRange("B1").setValue("Campaign Name");
	sheet.getRange("C1").setValue("AdGroup Name");
	sheet.getRange("D1").setValue("Average Position");
	sheet.getRange("E1").setValue("Max CPC");
	sheet.getRange("F1").setValue("Avg CPC");
	sheet.getRange("G1").setValue("Diff %");

	var keywordsIterator = AdWordsApp.keywords()
		.withCondition("AveragePosition < 1.1") 		.forDateRange("LAST_30_DAYS")		 		.get(); 	while(keywordsIterator.hasNext())  	{ 		var keyword = keywordsIterator.next(); 		var stats = keyword.getStatsFor("LAST_30_DAYS");	//Modify DateRange as per requirements			 			 		if(stats.getAveragePosition() == 1 && stats.getAverageCpc() >= 0.05)
        {
			row = sheet.getLastRow() + 1;

			maxCPC = keyword.getMaxCpc();
			avgCPC = stats.getAverageCpc();

			diff = (maxCPC/avgCPC)*100;

			sheet.getRange("A" + row).setValue(keyword.getText());
			sheet.getRange("B" + row).setValue(keyword.getCampaign().getName());
			sheet.getRange("C" + row).setValue(keyword.getAdGroup().getName());
			sheet.getRange("D" + row).setValue(stats.getAveragePosition());
			sheet.getRange("E" + row).setValue(maxCPC);
			sheet.getRange("F" + row).setValue(avgCPC);
			sheet.getRange("G" + row).setValue(diff);

        }
	}

	var newReportLinks = spreadsheet.getUrl();
	Logger.log("Report is Ready! Visit the following URL to see it :");
	Logger.log(newReportLinks);
	MailApp.sendEmail( RECIPIENT_EMAIL, 'Report is ready.', newReportLinks);	
}

function getSpreadsheet(spreadsheetUrl) {
  var matches = new RegExp('key=([^&#]*)').exec(spreadsheetUrl);
  if (!matches || !matches[1]) {
    throw 'Invalid spreadsheet URL: ' + spreadsheetUrl;
  }
  var spreadsheetId = matches[1];
  return SpreadsheetApp.openById(spreadsheetId);
}

Image: Keywords Cost — Original Billboard Image from Shutterstock

About the Author

Jonathan Levey is the Online Marketing Specialist at Sentient Jet. He has worked at Sentient Jet since January 2013 with a concentration in pay-per-click (PPC) advertising and search engine optimization (SEO). Prior to joining Sentient Jet, Jonathan served as an online marketing specialist with Fathom. Follow Jonathan on Twitter @jlevey.

Add Your Comments

  • (will not be published)

One Comment

  1. Hi, When i try to run the script I got an error message: TypeError: Cannot read property "biddingStrategyType" from null. (line 34) Line 34: maxCPC = keyword.getMaxCpc(); What can be wrong?