How to generate and set a Google Maps API key
Google Maps requires a special Google Maps API key. Without this key, you cannot display Google Maps on your website. There used to be two separate keys, the Google Maps API browser key and the Google Maps API GeoCoding key. Since Yoast Local SEO 11.9, only one Google Maps API key is required.
Want to learn all about local SEO? In our Local SEO training, you’ll learn how to optimize the website of your local business for search engines. So you’ll start ranking in your area! Check out our Local SEO training.
Before you can set this API key in your Local SEO installation, you’ll need to generate it. This tutorial will show you how to do that.
For ultimate SEO optimization, you need Yoast SEO Premium! For example, its advanced text analysis helps you write naturally flowing texts. The internal linking tool and the content filters make your posts easy to find. 404 errors become a thing of the past with the redirect manager. And the social previews give you full control of how your posts appear on social media. Get Yoast SEO Premium!
Table of contents
- APIs in the Local SEO plugin
- Generate a new API key
- View your existing API keys
- Add API key to Yoast SEO: Local
APIs in the Local SEO plugin
The Local SEO plugin uses four different APIs. These APIs can be enabled depending on your needs. We have outlined them below and described which features are used by them.
This API key is used to show a Google Map on your site. If you want to show a Google Map, enabling this key is required. This guide explains more about how to enable API keys.
Directions API (browser key)
This API key is used to provide directions between places. You need to enable this if you wish to use our Route Planner feature. Otherwise, it is not needed. This guide explains more about how to enable API keys.
Timezone API (browser key)
This API key tells Google to translate your latitude and longitude coordinates into the right timezone. This API key is needed if you want to use our Show Open/Close Message Widget. Otherwise, it is not needed. This guide explains more about how to enable API keys.
Geocoding API (server key)
This API key is used to translate address information into longitude and latitude coordinates. This API key is needed if you wish to use our Calculate Coordinates feature which automatically translates your physical address into longitude and latitude coordinates for Google to use. This key is also used to output coordinates for the Store Locator feature. It is also required if you wish to show a Google Map on your site. This guide explains more about how to enable API keys.
Generate a new API key
- Go to the Google Maps Platform
- Click the Get Started button in the middle of the screen.
- Click on the Google Cloud Platform home in the upper left corner.
- Click on Billing to make sure your billing details are up-to-date. If they are not, your Google Maps will not work properly.
- Once you’ve confirmed your billing is up-to-date, click on the Google Cloud Platform home in upper left corner again.
- Hover to APIs & Services and go to Credentials.
- If you want to use an existing project, please select it from the list. Otherwise, select ‘Create a new project’ and enter a project name.
- Click Create credentials and select API key. You will see a new dialog that displays the newly created API key.
- Click the Close button in the API key dialogue. Your new API key will be listed on the Credentials page under API keys.
View your existing API keys
- Go to the Google Maps Platform
- If the side menu is not visible, click the three-line (hamburger) menu icon
- Click ‘APIs & Services’ (API icon)
- Click ‘ Credentials’ (key icon)
If the above steps are not clear enough then please follow the tutorial video from the Google Maps Platform Team below. This video will show you how to generate and restrict API keys.
Add API key to Yoast SEO: Local
- Copy the API key you created from the Google Maps Platform.
- Log in to your WordPress website.
When you’re logged in, you will be in your ‘Dashboard’.
- Click on ‘SEO’.
On the left-hand side, you will see a menu. In that menu, click on ‘SEO’.
- Click on ‘Local SEO’.
The ‘SEO’ settings will expand providing you additional options. Click on ‘Local SEO’.
- Click on ‘API Keys’.
- Paste the API key you copied in step 1 into the ‘Google Maps API key’ field.
- Click ‘Save Changes’.
Check to see if Google Maps API keys are working
To check to see if your Google Maps are working try adding one by using a shortcode.
Are Google Maps not working?
If your Google Maps are not working for some reason, be sure to check out our troubleshooting article.
Securing your Google Maps API key
It’s recommended to secure your Google Maps API key against quota theft. In this article, we explain exactly how you can secure your Google Maps API key.