Friday, March 18, 2016

Developers: Saving Google API Credits with Autocomplete

There are a lot of winners with Google's new API pricing. However, if your app is using the whole suite of mapping functionality and you have a lot of users you might find your pool will start declining fast. Two functions that will draw directly on your pool and are not subject to the daily free quota is autocomplete and place search.

If you use your Google licence with the Scribble Maps API we do some of these optimizations out of the box, but if you are building your own custom implementation directly on top of the Google Maps API, there is a simple update you can do to save you some autocomplete credits.

The standard auto-complete functionality will send out an auto-complete request with every change in the input. It's possible to cut the amount of credits used significantly by putting in a timeout when the input changes.

Here is a very basic example.

 var acTimeOut;  
 textSearchInput.onkeyup = function() {  
 acTimeout = setTimeout(function() {  
 //put auto-complete calls in here  
 }, 250);  

So every time a user starts typing in the input the autocomplete will not fire until there is a momentary delay. The delay of 250ms can be reduced to make the autocomplete fire more often. If the user quickly types "Toronto", only one auto-complete call will be executed instead of 8 when the user hesitates.

We find the timed delay works the best. A critical point to this is to make sure that the user interface indicates that a search is going on as they are typing. In our case we use an animated spinner. This way if the user is typing quickly and not seeing results, the animated spinner will give them enough pause to see the results.

It should be noted that implementing this is compliant with their current terms of use. All this method essentially does is throttle the amount of out bound autocomplete calls from the user.


  1. I have never known Scribble Map up until now. I only use Google Map. This is great! We would have an alternative way in finding places.

  2. Thanks for such a great information and to provide us. We have the finest I mcafee certified technicians and If you're facing trouble in your mcafee antivirus software then just go through the link here. Click Here:-

  3. We have our Hotmail account technical service support experts equipped with the latest tools and Hotmail services to analyze your questions, grasp them instantly and sort your Hotmail account problems even quicker.

  4. Gmail users can easily obtain the great technical assistance at the time of forgetting security questions for account recovery related issues. In case you have forgotten security queries, you can take Gmail account support by dialing a Gmail customer service 1-800 toll free phone number.

  5. Find it good enough and here is one more think people should know its the latest Gmail customer support Toll-free number which is helping till your problem not solve.

  6. If you can consult a team of third party Gmail customer support providing company for obtaining the bulk number of issues in a right manner. Just depend on the Gmail tech support expert today to obtain the utmost solutions. Here your every issue will be sorted out instantly.

  7. You can to talk about your difficulty with your family and friend member who may be using the similar email service. May be they have faced comparable issue before and can share with you their ways of decision. You can also check some other online Yahoo mail customer service care that is available in the form of blogs and forums.