Map
Add a google map to your website.
The Map component is available as a free download via the Element Store, it requires a free Google Maps API key to function.
Google Maps API (Required)
To use the Maps component in Elements you need a Maps API key from Google. It only takes a few minutes to set up. The quickest way to get setup is to watch the video and follow the instructions below.
1. Create or sign in to your Google account
Visit the Google Cloud Console and sign in. If you have not used Google Cloud before, it will prompt you to create a new project.
2. Create a new project
Open the project selector at the top of the page
Click New Project
Give it a name, then create it
3. Enable the Maps JavaScript API
With your new project selected, open the left sidebar
Go to APIs and Services
Click Enable APIs and Services
Search for Maps JavaScript API
Open it and click Enable
4. Generate your API key
In APIs and Services, go to Credentials
Click Create Credentials
Choose API key
Copy the key that appears
5. Restrict your key
For security, set restrictions so the key can only be used from your website.
In the Credentials list, click your new key
Under Application Restrictions select HTTP referrers
Add the domains where your site will run
Save your changes
6. Add the key to Elements
Open the Google Map component in Elements and paste the key into the API Key field. Once added, your map will load correctly during preview and when published.
Testing locally on Your Mac
When working locally, you need to add referrers so your Google Maps API key works in both Elements preview and on your published site.
Add your live domain with two referrers:
https://www.mydomain.com/ https://www.mydomain.com/*
To support local preview, first open the Elements Advanced settings and set a fixed preview port so it stays consistent.

Add that URL as another two referrers in the Google console. For example:
http://127.0.0.1:61109 http://127.0.0.1:61109/*
Last updated
Was this helpful?

