Google Maps API Cost Management and Usage Optimization
Hey! Try out our new documentation pages, hope you like it!
Google Maps has limited free usage quotas/limits, if you go over this usage value, you will be billed for service usage. See our recent announcement for more information about the new pricing changes for Google Maps API.
The purpose of this page is to provide information on how to reduce or entirely mitigate the costs of using the Google Maps API service by optimizing your usage of the service and staying as close to or within the limits of the free monthly usage allowance. For information about usage, see the Google Maps APIs we use and where we use them.
First step… estimate your usage!
This is by far the most important step, as it will help you make subsequent decisions.
Do you get a lot of visitors? If you get only a few thousand visits a month on your site, all of this is likely to be irrelevant as you’ll be well within the limits of Google’s free usage tier. The only thing we’d recommend is still set up quotas, just in case, which we cover further down. If you get thousands of visitors per day, then you’re likely going to want to explore further and understand what pages visitors regularly visit on your site and optimize accordingly.
It’s important to understand what kind of usage your site gets, because depending on what kind of site you have, you may have different usage expectations. For example, if you’re a site that accepts guest submissions of events, you’ll certainly want to monitor your dynamic map loads usage on your submission pages, whereas if you run a popular events site where a handful of admins load events to specific sets of locations, you’d probably concentrate more on the display of maps for the events you publish.
Managing Events Manager Google Maps Features
Map loads will probably be the largest Maps API call consumer on your site. This should be your primary focus of attention.
The first important step is choosing the Google Map type to display on your site according to your needs. We recommend enabling Static Maps if you have Events Manager Pro, or alternatively enable Embedded Maps in Events Manager. We cover google map types and their API usage separately and extensively.
Additional considerations to make is when and where to display your maps. By default, Google Maps are displayed on the event and location page, but you can always choose whether or not to display these maps on either page by modifying your event formats.
We would also strongly advise not showing maps on your event lists, or loading multiple maps on the same page. For example, if two maps show up on the same page, that page will double your consumption rate.
Geolocation Autocomplete Queries
Depending how you set up your site, it’s possible that your site users search for events far more than they actually view event/location pages, in which case the Autocomplete API may get heavily used. Unfortunately, there’s little that can be done to optimize these queries. The main question you need to ask yourself is whether this feature is really necessary for you to achieve an efficient user searching experience.
Remember, that you can also enable users to filter events by location parameters such as country, city and region, which will narrow down search results sufficiently for most without using the API at all. You can disable the Geolocation Search field entirely via your Dashboard > Events > Settings > Formats > Search Form > Show Geolocation Search? and setting that to ‘no’.
Event and Location Submission Forms
Event and location forms will load dynamic maps each time a page containing location information is loaded, or if a user starts typing an address into a new event/location form. If the amount of events and locations you create and manage regularly are limited, this likely won’t be a concern for you
If you accept user submitted events, this is a source of API usage. Consider whether you would really like guests to submit events anonymously, or if you can force them to register first. By doing so you will prevent random visitors from coming to your site and playing around with submission forms and generating API usage even if they don’t submit an event (or spam you).
Further General Advice
Do you even need Maps?
Ask yourself whether you even NEED Google Maps in the first place!? Do you only have one or a handful of locations, even if you have many events? If so, it’s likely your users won’t search for events by locations anyway, and map generation is very consistent. Consider not using Google Maps at all… grab a screenshot of your location from a non-copyrighted source, such as Open Street Maps, and leave it at that!
You could even link to Google Maps with a regular link within the description of your location, or even set up a custom field where you can store a maps.google.com URL and show it as a link via your formats, there’s lots of ways to inform users of your event locations, they might just require a little more work to begin with!
Set Quotas, Not Just Budgets!
Google is not very emphatic about how to prevent a large bill, so we feel we should be. There’s two ways Google offers for you to help control your spending, Quotas and Budgets. Budgets are only informative, they will not prevent you from racking up the bill should spending go past your comfort zone.
Quotas are the only way to programatically limit your usage, the downside being that if you go over your quota, maps stop working. This is why we recommend, particularly for displaying maps, to use our Static Maps feature in Events Manager Pro, and enable map caching.
We suggest that you visit your console account, disable any APIs you don’t need, and then set up quotas for every API you keep enabled. Use Google’s pricing calculator to build a balanced set of quotas that remain within the limits of your budget.
Restrict your API Keys
If you haven’t already, ensure the API keys you’re using are restricted for use only on your sites and servers. If someone gets a hold of your key, they can use it at will on their sites, and you’ll foot the bill!
See our Google Maps API Key Setup instructions which covers this step.