Create Google Map API Key
* Note, this tutorial in some steps refers to the Gravity Geolocation plugin. However, the creation of the API key is the same for other geolocation plugins as well. Make sure to enter the Google API key in the settings page of your plugin.
Follow the steps below to create Google Maps API key for your project and to enable the required API services.
- Navigate to the Google Maps Platform and Click 'Get Started'.
- Check the 'Maps', 'Routes' and 'Places' checkboxes and click Continue.
- Either select an existing project or create a new project. If you are creating a new project, you will need to enter a name for it. Click 'Next' when you are done.
- At this point, if you don't already have a billing account, you will need to create one. If you do need an account, follow all the steps to create the billing account ( those steps are not mentioned in the tutorial ).
- Click Next to enable the API services and create an API key.
- Copy the newly generated API key ( you'll need this to enter in the settings page of your plugin later ) and click the API Console link.
- Enter a name for your project in the 'Name' input box.
- Scroll down that same page. In Application Restriction select 'HTTP Referrers' and enter your website's URL in the input box. For example gravitygeolocation.com/*. When you are done, click 'Save'. You will then be redirected to the Credentials page where you will see your new API key
- Click 'Dashboard' on the menu to the left.
- Scroll down to check if all the required API services enabled. By default, all the Map API services should be enabled. The required API services you need to look for listed below:
- Directions API
- Distance Matrix API
- Geocoding API
- Geolocation API
- Places API
- Roads API
- Street View API
- Maps Static API
- If any of the API services are missing or disabled, you'll need to enable them. To do so, click the 'Enable APIs and services' button.
- Now you can either type and search for specific API/service, or click 'view all' in the 'Maps' category to view all the map services.
- Find the specific API that you would like to enable and click on its box.
- Click 'Enable' to enable the API service.
- Repeat steps 11 to 14 to enable all the required API services that were mentioned in step 10.
You are done. Your API key should now be ready to use.
If you haven't done so, copy your new API key from the dashboard and enter it in the settings page of your plugin.