Will Google throttle attempts to obtain user location using client-side jsapi calls?

635 views Asked by At

I installed this JavaScript project which attempts to obtain the user's geolocation using client-side JavaScript.

https://github.com/codejoust/session.js/

The default mechanism for the location lookup is Google's jsapi feature.

Will Google throttle my app's ability to obtain this information after a certain number of requests?

The function in question looks like this:

gapi_location: function(){
      return function(callback){
        var location = util.get_obj(options.location_cookie);
        if (!location || location.source !== 'google'){
          win.gloader_ready = function() {
            if ("google" in win){
              if (win.google.loader.ClientLocation){
                win.google.loader.ClientLocation.source = "google";
                callback(win.google.loader.ClientLocation);
              } else {
                callback({error: true, source: "google"});
              }
              util.set_cookie(
                options.location_cookie,
                util.package_obj(win.google.loader.ClientLocation),
                options.location_cookie_timeout * 60 * 60 * 1000);
            }}
          util.embed_script("https://www.google.com/jsapi?callback=gloader_ready");
        } else {
          callback(location);
        }}
    },
2

There are 2 answers

1
Mano Marks On BEST ANSWER

I think you're not asking about Geocoding, but about location. ClientLocation is deprecated, shouldn't be relied on. I would use HTML5 Geolocation as your first option, as demonstrated in this sample.

1
WojtekT On

From: http://code.google.com/intl/pl-PL/apis/maps/documentation/geocoding/#Limits

Usage Limits Use of the Google Geocoding API is subject to a query limit of 2,500 geolocation requests per day. (User of Google Maps API for Business may perform up to 100,000 requests per day.) This limit is enforced to prevent abuse and/or repurposing of the Geocoding API, and this limit may be changed in the future without notice. Additionally, we enforce a request rate limit to prevent abuse of the service. If you exceed the 24-hour limit or otherwise abuse the service, the Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Geocoding API may be blocked. Note: the Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.