Question to retrieve google search autocomplete suggestions/predictions

mohsen

New member
Joined
Jul 1, 2015
Messages
3
Programming Experience
Beginner
Hi.
I'm new to programming and this forum is my first one and this post is my first one.
I'm not that much into programming, and I don't really know much... almost nothing TBH!
The thing is, I'm becoming more interested in SEO (search engine optimization) techniques. For that, I need to have a complete list of suggestions/predictions provided by google around a certain keyword. For instance, when you type the word "insurance" in a google search, google gives you a lot of suggestions, including words and phrases that come before as well as after that certain keyword. Now what I want is a complete list of these predictions/suggestions that includes each and every possible suggestion or prediction. It's obviously a painstaking and time-consuming job to manually do such a thing!
While searching for such a solution, I came across this. But the problem is that I don't know what exactly it is and how to use it! All that I know is that it's a JavaScript code, which is too obvious of course.
Is this what I'm looking for? If so, how do I use it? And if not, can you offer such a solution?
FYI: I have Microsoft Visual Studio installed and ready.
 

mohsen

New member
Joined
Jul 1, 2015
Messages
3
Programming Experience
Beginner
I tested the above code in my weblog, but it delivers only place names and suggestions... far from what I'm looking for!
Anyone? Help, please!!!
 

JuggaloBrotha

Staff member
Joined
Apr 23, 2011
Messages
178
Location
Lansing, MI; USA
Programming Experience
10+
Hi.
I'm new to programming and this forum is my first one and this post is my first one.
I'm not that much into programming, and I don't really know much... almost nothing TBH!
The thing is, I'm becoming more interested in SEO (search engine optimization) techniques. For that, I need to have a complete list of suggestions/predictions provided by google around a certain keyword. For instance, when you type the word "insurance" in a google search, google gives you a lot of suggestions, including words and phrases that come before as well as after that certain keyword. Now what I want is a complete list of these predictions/suggestions that includes each and every possible suggestion or prediction. It's obviously a painstaking and time-consuming job to manually do such a thing!
While searching for such a solution, I came across this. But the problem is that I don't know what exactly it is and how to use it! All that I know is that it's a JavaScript code, which is too obvious of course.
Is this what I'm looking for? If so, how do I use it? And if not, can you offer such a solution?
FYI: I have Microsoft Visual Studio installed and ready.
The example Google provides with your link is an html file that calls the Google search suggestions webservice using Javascript, all you have to do is make the same Javascript call to their webservice and it'll send back the results. Specifically:
C#:
function initialize() {
  var service = new google.maps.places.AutocompleteService();
  service.getQueryPredictions({ input: 'Rain Forest Cafe' }, callback);
}

function callback(predictions, status) {
  if (status != google.maps.places.PlacesServiceStatus.OK) {
    alert(status);
    return;
  }

  var results = document.getElementById('results');
}
The Google example has code for formatting those results too which is what this shows:
C#:
for (var i = 0, prediction; prediction = predictions[i]; i++) {
  results.innerHTML += '<li>' + prediction.description + '</li>';
}
 

mohsen

New member
Joined
Jul 1, 2015
Messages
3
Programming Experience
Beginner
Thanks @JuggaloBrotha.
So does this code give suggestions based on a certain keyword? Because the one that I had found only gives place names and suggestions for that keyword. I don't want place names or maps. I want keyword suggestions.
 
Top Bottom