Get a Google API Key
Open Street Maps (OSM) can be used as a free alternative to Google Maps. Simply leave the Google API Key input empty and the system will use Open Street Maps.
Prerequisites
- API Key - A Google API key is required to use Google Maps features.
- Google Account - A Google account (which is free) is required to be able to generate an API Key.
- Billing Account - Google now requires a credit or debit card on file for Maps to work. You are given $200 free credit each month which will essentially mean the service is still free for the majority of users.
Step 1 - Sign in or Signup to Google
You are required to have a Google account to obtain an API key. Sign in to Google or Create an account.
Step 2 - Generate an API Key
- Generate a Key - In your website's GeoDirectory Settings under GeoDirectory > Settings > General > Google Maps API KEY. You will see a button to generate an API Key, click the button.
-
Create a Project - You are required to create a project name, we suggest "GeoDirectory" however if you already have a project you wish to use then you can select it from the list. Once done, click NEXT.
-
Copy & Save API Key - After you click "Next" on the last screen you will be shown your API key, you need to copy this and paste it into your GeoDirectory Settings and Save.
Step 3 - Activate Billing Account
- Select Project - Open this Google page and select the project you created or selected in step 2.
- Enable Billing - If you do not already have a billing account setup then you will be asked to create one. Click "Create Billing Account".
-
Enter Billing Details - Follow the instructions and fill out the billing details and Submit.
-
Add billing to the project - once you have billing setup, then you must assign the billing account to serve as the billing account for the API project you are working with.
-
Done - After completion, it may take up to 15 minutes before your API key will start working.
Step 4 - Restrict API Key Access
WARNING: Restricting the API key HTTP referrers will prevent our import feature that attempts to fix addresses with missing location data, if you plan to use this feature then please follow step 5.
At this point, your API key should be working on your site, the issue is that anyone could view your key and use it on their site, using up your budget. You may have received an email titled "Publicly accessible Google API key for Google Cloud Platform project", this is how you restrict the API key.
- Select Project - Open your Google Console credentials page and select the project you are using for GeoDirectory.
-
Select the Key to Edit - Click the edit icon next to the key you wish to edit.
-
Restrict Access - Set the restriction to "HTTP referrers" and then enter any websites you wish your key to work on in the settings.
Please note the format where * represents a wildcard. If you enter only mywebsite.com then www.mywebsite.com will not work, so either enter both or use the wild card of *.mywebsite.com/*
Please Note: *.mywebsite.com/* will not work if your domain is https://mywebsite.com you MUST also add mywebsite.com/*
Step 5 - Geocoding API Key (optional)
When importing listing with partial location info our system will attempt to fill in the missing parts by adding either GPS or location data. If the main API key is HTTP referrer restricted then this functionality will not work, the solution to this is to create a second private key that is unrestricted or IP restricted to your server.
- Select Project - Open your Google Console credentials page and select the project you are using for GeoDirectory.
-
Create API Key - Select "Create Credentials" and then "API key".
-
Rename - As this key may need to be unrestricted to work we suggest editing and renaming the key such as "Secret Geocode".
-
Save - On your GeoDirectory Website visit GeoDirectory > Settings > General > (click advanced, top right) > Google Geocoding API Key. Paste the secret key into the setting and save.
APIs required
The most important points for this second key are that the project has all 11 APIs added and the second key should have no restrictions.
Help! My Maps aren't Loading for Users!
If, despite following the above instructions, your Maps do not seem to work for your site visitors, but you can load them perfectly fine when logged in, it is almost always a caching issue.
Try to clear your website's cache -- you can do it from your caching plugin. More importantly, try to delete any CSS/JS minification files as well. After that, Maps should load perfectly fine.
Help! I was using the Google Maps Trial and it stopped working!
Even though Google collects your CC when you sign up for the trial, when the trial ends they do not auto-bill you. You have to log back into the console and 'upgrade' to the paid version.