Google API cost reducer add-on - Google Location Guard

In this topic the issue of elevated maps geo location etc came up.

I have developed a addon that allows you to restrict the use of API.

I have several addons I will roll out once I get a chance to set up on the cs-cart marketplace. I will update this post once I have a store. However noting this can save you money from day 1 and I am time-poor at the moment please message me for a copy. Depending on useage you might save the cost in a couple of days! This shows the cost drive down for me as as I developed and tested it (note the first couple of weeks was googles free usage).

Google Location Guard Function Summary

In simple terms: the add-on is designed to reduce Google API costs caused by bots and unwanted automatic location checks, without blocking the storefront or stopping real customers from choosing their location manually.

Google Location Guard reduces unnecessary Google location API usage in CS-Cart/Multi-Vendor while keeping normal
customer location features available.

It helps by:

  • Blocking automatic browser geolocation for risky traffic, such as bots, crawlers, empty user agents, or optionally visitors outside selected countries.
  • Preventing unnecessary calls to Google Geolocation and Google Geocoding APIs when automatic detection is blocked.
  • Allowing genuine customers to manually use “use my location” when enabled, so the customer experience is preserved.
  • Integrating with AB Antibot when available, using its bot/whitelist decisions.
  • Falling back to built-in crawler detection if Antibot is not available.
  • Supporting optional country-based geolocation restrictions using Cloudflare/GeoIP-style country headers.
  • Logging blocked geolocation attempts for admin visibility.

3 Likes

Updated: previous version had partial JavaScript protection, but still delivered Google provider scripts, only logged dynamic Maps loads, and allowed Antibot-whitelisted crawlers.

upgraded to

  • Suppresses geo_maps and vendor_locations Google provider scripts for detected crawlers.
  • Blocks dynamic Maps JavaScript, Geolocation, and Geocoding requests.
  • Covers CS-Cart crawler detection, AB Antibot blacklisted/whitelisted bots, fallback user-agent matching, and empty user agents.
  • Prevents simulated clicks from bypassing crawler blocking.
  • Avoids crawler-generated logging loops and cache poisoning.
  • Preserves manual location functionality for legitimate customers.
  • Modifies no CS-Cart core files.

Added reminder to addon description: “Keep strict Google API restrictions, daily quotas, and billing alerts—the add-on cannot stop someone who directly reuses a browser-visible key while spoofing a normal browser and referrer. You can set quotas in your Google Cloud account for each API (Maps JavaScript API, Geolocation API, and Geocoding API). Set domain restrictions for each API key, and use a separate key for each add-on requiring a Google key.”