Search the knoladge base

[betterdocs_search_form__]

Create Google Maps 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 a Google Maps API key for your project and to enable the required API services.

  1. Navigate to the Google Maps Platform and Click ‘Get Started’.
  2. Check the ‘Maps’, ‘Routes’ and ‘Places’ checkboxes and click Continue.
  3. 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.
  4. 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 ).
  5. Click Next to enable the API services and create an API key.
  6. 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.
  7. Enter a name for your project in the ‘Name’ input box.
  8. 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
  9. Click ‘Dashboard’ on the menu to the left.
  10.  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:
    • Maps JavaScript API
    • Directions API
    • Distance Matrix API
    • Geocoding API
    • Geolocation API
    • Places API
    • Roads API
    • Street View API
    • Maps Static API

  11. 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.
  12. Now you can either type and search for a specific API/service, or click ‘view all’ in the ‘Maps’ category to view all the map services.
  13. Find the specific API that you would like to enable and click on its box.
  14. Click ‘Enable’ to enable the API service.
  15. 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.