Script for getting more keyword suggestions
This script is useful for getting more search suggestions. It will generate a CSV with many keywords for you to use.
To begin, you will need a simple spreadsheet with only one column called Keywords.
In the settings of the script, input your source spreadsheet URL and the sheet name, which will be used in the final CSV name.
Paste the code into this column and run the script.
/* SETTINGS */
//Your own copy of our template -
var SPREADSHEET_URL = "";
var SHEET_NAME = "Keywords";
var LANG = "de";
/* ------ */
function main(){
var output = [];
var spreadSheet = SpreadsheetApp.openByUrl(SPREADSHEET_URL);
var sheet = spreadSheet.getSheetByName(SHEET_NAME);
var numRows = sheet.getDataRange().getLastRow();
for (var i = 2; i <= numRows; i++ ) {
keyword = sheet.getRange(i, 1).getValue();
var response = UrlFetchApp.fetch("http://suggestqueries.google.com/complete/search?&client=chrome&hl="+LANG+"&q="+keyword);
var json = response.getContentText();
var data = JSON.parse(json);
for (var j = 0; j< data[1].length; j++){
output.push([data[0],data[1][j]]);
}
Utilities.sleep(20);
}
doCSV(output,"Suggestions - "+SHEET_NAME+".csv");
}
function doCSV(input,name) {
var data = input.join("\n");
var file = DriveApp.createFile(name, data);
Logger.log(file.getUrl());
}
Co-owner of the PPC agency Lynt. Writes at jakubkasparu.com.