In order to use Google maps on your site you need an API key. Lets see how we can get one.
- Navigate to the Google API Console you will see this
select whether you want to receive updates on the product or not, check the terms radio button and click the Agree and continue button.
- Next is the Credentials screen. Here you can name your API key and click the Create button.
- Your API key will pop up in the next screen, like so
copy it and paste it in your theme’s Google Maps API key input box and then click OK in the above box.
That’s it, now you have a working Google map embed.
Fortifying your API key
Google has a quota on daily hits an API key can get, then it starts charging for the API’s usage. To prevent quota theft you can set a referrer URL in your key’s setting so it only accepts requests from your site.
To do that go to the credentials screen again and click on the API key’s name
In the next screen add your site’s URL in the referrer box and click Save
Enabling the Google Maps Embed API
To be able to embed maps using your API key you will need to enable the embed API. To do that, in the API manager navigate to the Library tab and search for maps embed, click on the single result that comes up.
In the next screen, click the Enable button to enable the embed API.