How do I set up Google Maps, geocoding and get API keys?
We can display maps on specific pages of your website and mobile app, powered by Google Maps.
These pages are:
- Mobile in-app events page
- School closures school page
- Local Directory business page
- Events Calendar - home, event, venue and category pages
- Voucher page
We also use Google's Geocoding service, which turns a street address into a set of co-ordinates.
The sections where we use geocoding are:
- When searching the Events Calendar, if you enter a location
- When searching the Local Directory for businesses near the location you enter
Google require each website to have API keys for these services, and where applicable for a key to be restricted so it cannot be used on other websites.
To get your API keys, sign up for an account with Google and add a payment card, which will be billed if usage via your website/app exceeds their access quotas.
Find out more and register for Google Maps Platform.
While we can't directly support 3rd party services, we have put together this guide which advises how to get set up.
Please bear in mind that Google may change their service at any time, and our instructions are only accurate at the time they were written.
Setting up your Google account
- When registering, select the Maps and Places products.
- Use a work/company Google account rather than a personal one.
- When asked to enter a Project Name, use your radio station name.
If you have a group of stations, you'll be able to use the same API keys for all of your stations, so consider using your company's name. - You'll be asked to create a billing account, or select an existing one. Google may charge you if your usage exceeds the quotas they enforce.
- Once you're registered, go to the Google API Console.
- Go to the Google APIs section, and enable these APIs:
- In the Google Cloud Platform main menu, navigate to APIs & Services, then Credentials.
- Create two API keys. You'll need to paste them into the boxes in our settings page.
For each key, select Restrict Key and set it up as follow: - For the first one, call it Maps.
- In the Application restrictions choose HTTP referrers.
If you have one website, you can enter its URL.
If you have a mobile app, you'll need to enter your 'staging URL'.
If you have multiple websites/apps, you'll need to enter all their URLs - tap enter to add each one in turn.
We've provided a quick reference page which shows all the URLs in your organisation. - Go to the API restrictions and add both the Maps Static API and Maps JavaScript API. If you don't see them here, then you didn't successfully enable them earlier.
- In the Application restrictions choose HTTP referrers.
- For the second key, call it Geocoding.
- Leave Application restrictions set to none.
- Go to the API restrictions and just select the Geocoding API.
Once you've got your two keys and added them to the settings page, that's all there is to it. Test they work by navigating to one of the pages listed at the top of this guide.