Setting Up Google Maps API Keys and Libraries
In order to use any Google Maps service, you must enable the relevant Google API Libraries, and obtain a Google Maps API key which you’ll add to your Events Manager settings page.
If you’re unable to load maps or are seeing Location Not Found errors when trying to use maps in Events Manager, make sure you’ve completed the steps below.
We have removed screenshots, as Google regularly changes their interface and also has varying interfaces for different account types and countries. If these steps don’t work for you, please check Google’s documentation for creating API keys and enabling libraries, and follow our recommendations for the required libraries and API Key restrictions.
Step 1. Sign into your Google Cloud account (or create one)
If you already have a Google Cloud Platform account:
- Visit the Google Cloud Platform, sign into your Google Account if asked.
- Select the desired project from the top right of the screen, if you haven’t created one already, you’ll be asked to do so at this stage.
If you don’t have a Google Account or have not previously used Google Cloud Platform:
- Visit the Google Maps Platform website, and click the ‘Get Started’ box.
- Choose the ‘Maps’ and ‘Places’ checkboxes and click continue.
- You don’t have to choose both, you can just choose Maps and enable/disable libraries in the next steps.
- Log in or create a new account in the next screen.
- Follow the next instructions to set up your project name and billing details.
- At the last step, Google will create new API key for you and enable some API libraries, we’ll cover these in following steps.
Step 2 – Enable the relevant API Libraries
- Visit the Google Maps API Libraries page. You’ll see a list of libraries that are enabled, and a second list of disabled libraries.
- Ensure you have the right project selected at the top left of the page.
- Enable the Libraries you need (see below) by clicking on the Library name, and then the ‘Enable’ button.
- You may see some libraries already enabled, we recommend you disable the libraries you don’t need.
The libraries you need depend on which features you’ll be using in Events Manager. Here’s a list of the ones you’ll need below and also the optional libraries you might need:
- Places API for Web
- Geocoding API (required if you use the geolocation field in your search forms)
- Maps Embed API (required if you chose Embedded Maps as your map type, or as a click action for static maps)
- Maps Static API (required if you chose the Static Maps as your map type)
Step 3 – Get your Google Maps API key
Google’s official instructions are somewhat confusing, especially if you’re not a developer, so we’ve created some of our own step-by-step instructions:
- Go to Google Cloud Platform’s Credentials page.
- Make sure you’ve selected the same project you set up your libraries in step 2 at the top left of the page.
- If you don’t have any API Keys already created:
- Click the ‘Create Credentials’ button and select API Key
- You’ll see an API Key has been created and a confirmation window showing your new key.
- Click the ‘Restrict Key’ option.
- If you see an API key already in the list (or you clicked the ‘close’ button on step 3), click on it.
- (optional) Edit the key Name field so it’s something meaningful and easy to remember (e.g. Events Manager Browser Key)
- In the Key Restrictions section, select Application Restrictions and then HTTP referrers (web sites)
- You’ll see a text box appear under Accept requests from these HTTP referrers (web sites). To make sure that map requests work from anywhere on your domain, we recommend adding more than one entry using the following patterns:
- Click ‘Save’
- Copy your newly restricted API key from your list of keys, for use in Step 4.
If you have enabled static maps as your map type, then you will need to repeat these steps to create a new server API key. However, instead of choosing ‘HTTP referrers’ in step 6, you’ll need to choose ‘IP addresses’ and enter your server IP in step 7. To find your server IP, use this tool and type in your site url.
If you notice any other API keys in your list, make sure they are also restricted appropriately, and delete any keys you don’t use. Unrestricted API keys will show an orange exclamation mark next to it.
Step 4 – Add the API key to Events Manager
Go to Events > Settings > Google Maps and Location Services and paste your key into Google Maps API Browser Key.
Click Save Changes and create an event with a map to check that both admin and front-end functions are working correctly,
If you’re having problems getting Google Maps to work on your site, try testing with Accept requests from these HTTP referrers (web sites) left blank.
If maps are loading with that setting, it indicates there’s a problem with either the domain name or the pattern used with it.
If maps still don’t load, you may have a problem with the way Events Manager is configured.
Aside from testing, we recommend using a domain pattern in Accept requests from these HTTP referrers (web sites) to prevent unauthorized use of your API key.
Note: This credentials page in the Google API Console also shows the usage and quotas for your account, if you need to check this later.