Documentation

How to Create Google Maps API Keys for Gravity Geolocation

Last modified: March 16, 2025

Follow the steps below to create both the Server and Browser API keys required for your Google Maps integration. These Google Maps API keys are essential for enabling various geolocation features in the plugin.


Step-by-Step Guide to Google Maps API Keys

1. Go to the Google Cloud Console

2. Create a New Project or Select an Existing One

  • In the top navigation bar, click the Project Selector.
  • Select an existing project or click New Project to create a new one.
  • Give your project a name and click Create.

3. Enable Google Maps API Services

  • From the Dashboard, click APIs & Services > Library.
  • Search for the following APIs:
    • Maps JavaScript API
    • Geocoding API
    • Places API (Legacy) Enable Here
    • Places API (New)
    • Directions API (Legacy) Enable Here
    • Routes API
    • Maps Static API
    • Geolocation API
  • Click on each API and then click the Enable button.

Note: Google has replaced the Places API (Legacy) with the Places API (New) and merged the Directions API into the Routes API. However, the plugin is not yet fully compatible with the new API services.

While the plugin update is in progress, you will need to enable both the new APIs ( Places API (New) and Routes API ) as well as the legacy APIs by visiting their respective pages:

Once the plugin is updated, it will fully support the new API services.

4. Create a Browser API Key

  • Go to APIs & Services > Credentials.
  • Click + Create Credentials > API Key.
  • An API key will be generated. Copy this key for later use.
  • Click Restrict Key to limit its usage:
    • Application restrictions: Select HTTP referrers (websites).
    • Add your website's domain (e.g., https://example.com/*).
  • Save your changes.

5. Create a Server API Key

  • While still on the Credentials page, click + Create Credentials > API Key.
  • Another API key will be generated. Copy this key as well.
  • Click Restrict Key:
    • Application restrictions: Select IP addresses.
    • Add the IP address of your server.
  • Save your changes.

Final Note

Having properly configured Google Maps API keys is essential for ensuring the smooth operation of your geolocation features. By following the steps outlined above, you can securely integrate Google Maps into your project and unlock advanced mapping capabilities.

If you encounter any issues or need further assistance, don’t hesitate to refer to the Google Maps API Documentation or reach out to our support team.

Helpful Links

menu-circle