Generating Google Maps API Keys
Follow the steps below to create both the Server and Browser API keys required for integrating Google Maps with Geolocation for WPForms. These API keys allow you to enable geolocation-based features such as address autocomplete, map fields, and geocoding within WPForms.
Setting Up Google Maps API Keys
1. Go to the Google Cloud Console
- Visit the Google Cloud Console.
- Log in with your Google account.
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 APIs
- 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.
Important: Google has introduced new API services, replacing the Places API (Legacy) with the Places API (New) and merging the Directions API into the Routes API.
WPForms Geolocation does not yet support these new APIs fully. Until an update is released, you will need to enable both the legacy and new APIs:
- Enable Places API (Legacy): Click Here
- Enable Directions API (Legacy): Click Here
Once Geolocation for WPForms is updated, it will fully integrate with the new API services.
4. Generate & Restrict Your 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/*
). - API restrictions: Enable Maps JavaScript API, Places API, and Geocoding API.
- Save your changes.
5. Generate & Secure Your 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.
- API restrictions: Enable Geocoding API and Places API.
- Save your changes.
Final Notes
Setting up the correct Google Maps API keys ensures that WPForms Geolocation can provide accurate location-based functionality, such as address autocomplete and mapping features.
If you experience issues, please check:
- That all required APIs are enabled in Google Cloud Console.
- That API keys are correctly restricted for security.
- That the Geocoding API and Places API are active.
For additional help, refer to the Google Maps API Documentation or contact WPForms Geolocation support.