Enable Google Maps
The Sharetribe Web Template offers out of the box support for Google Maps API for showing a map and searching locations with search autocompletion. This guide describes how to set up the API key for the API requests to work properly.
Table of Contents
To enable Google Maps in your marketplace, you will need a Google Account. In addition, in order to enable the required Google APIs, you will need to enter your billing details.
Make sure to follow API security best practices with your Google Maps API keys. For example, restricting your API key to your client app URL will prevent unauthorised use that would impact your billing.
If you are using a version of the template v3.4.0 or newer, you can set the API key in the Sharetribe Console.
In Sharetribe Console, navigate to Integrations > Map
Select "Google Maps"
Paste the token into the field
Press "Save changes"
Read more in our article on how to set up Mapbox or Google Maps for location services.
You can also choose to assign the map key to an environment variable. However, if you enable the API key configuration through Console, the settings in Console will overwrite the keys stored in environment variables, assuming that you have not made changes to how the template handles loading configurations via assets.
The template uses the
variable for the key value. For local development, you can add the
variable in the gitignored
.env file in the project root:
To enable Google Maps, you must toggle a configuration variable found in
This configuration variable can be one of two options:
'GOOGLE_MAPS'. To enable Google Maps in the template, change the
export const mapProvider = 'GOOGLE_MAPS';
Once you have enabled maps in your marketplace using your chosen map provider, you can change the map's configuration settings. These options allow you to change things like the default search locations and restrict location search to specific countries. Refer to the map configurations article to learn more about the specific configurations you can adjust for maps in your marketplace.