Your Google Map API Key can be used on multiple authorized websites.
When you first created your Google Map Key, one of the most important steps was to protect your budget and quota by restricting it's use to only your domains so that it could not be used by others.
If you don't restrict the key by website, then others can use your Google API key and quickly deplete your budget, or incur costs on your Google account!
If you have changed your domain name, or you want Google Maps to work on another domain, (for example, a temporary domain for development), then you will need to adjust 'Website Restrictions' in your Google API account to add additional authorized domains that can use your Google Map API key.
1. Login To Your Google Maps Platform Account
If you have multiple Google accounts, make sure to go to the one you used for your Maps API Key.
- Make sure you're logged into a Google account (Gmail or any Google account)
- Then go to the Google Maps Platform page:
https://console.cloud.google.com/google/maps-apis/home. - Select the correct Project Name.
Make sure that you have the correct project selected in the top blue bar.
2. Go to Key Restrictions
- In the left menu, select the menu item for Credentials.
In the main panel, you will now see a table headed "API Keys". - Click the name of the API key that is shown (probably called "API Key" or similar).
You will then see the 'Key Restrictions', page - as shown below.
(If you don't see this then you are probably in the wrong Google account).
4. Add 2 Versions Of Your New Domain
You need to include your NEW domain in the website restrictions list.
This requires adding two formatted website addresses for the NEW domain.
The website addresses to use can be copied from your Buying Buddy dashboard.
- Open your Buying Buddy dashboard in a new tab
- Go to Widgets > Installation and Setup > Google Map Key tab
- You'll see two correctly formatted website addresses
- Copy each address using the blue Copy button
- Return to Google Maps Platform
- Click the blue + ADD under Website restrictions
- Paste the value and click Done
- Repeat for the second address (it will be similar but starts with "*.")
- You should now have two entries for each site, like this:
- Next, under API Restrictions, make sure Don't restrict key is selected
- Click Save
Do not be tempted to change or modify any other settings or restrictions on this page!
You are done! When the maps load using your API key on this new website, the domain is now authorized.
Useful direct links for Google Maps Platform
- Direct Link to the Google Maps Platform - https://console.cloud.google.com/google/maps-apis
- Link to set budgets - https://console.cloud.google.com/billing/budgets
(only important if you have very high use and need to manage costs)