Limiting your Google Maps key to your own site
If you've set up a Google Maps key for use with Stockist, your Google Maps key will be used on your website to display your map and power portions of the search. See more details about choosing a map provider.
Due to the way the Google Maps plugin works, your key will be included in the source of your website in order to be used to load the map. To avoid the possibility of another site copying your key and incurring usage on your Google Maps account, we strongly recommend restricting your key to only work on your site's own domain(s). This will ensure that other websites won't be able to use your key.
To protect your Google Maps API key from unauthorized use by other websites, or if we've indicated that your key may not be set up correctly due to a missing referrer, please follow the steps below to set the list of websites (also known as "referrers") that are allowed to use your key.
Configure the allowed websites for your key
Follow the steps to ensure your website is in the list of permitted sites for your Google Maps key:
- Open the Google Service Credentials page. Make sure you're logged into the same Google account you originally used to set up your key.
Check that the project chooser at the top of the page is showing the the project that contains the Google Maps key you initially created when setting up Stockist on your website:
In most cases, there will only be a single project listed there.
A list of API keys will appear - click on the name of the key to open the details page:
On the key details page, double-check that the key shown there is the same one that was added to Stockist under Settings > Map provider. You can just check the last 5-6 characters to make sure they match. If you edit a different key than the one added to Stockist, your changes won't take effect for your Stockist map.
On the key page, under Set an application restriction, select Websites:
Next, under Website restrictions, add your website's domain(s) to the allowed list. Assuming your site is example.com, you'll want to add both of the following:
- example.com/*
- *.example.com/*
Just replace example.com with your actual website domain. If you normally use a www on your website (e.g. www.example.com), leave off the 'www.' part in the entries above.
Note that the positioning of the periods, slashes, and asterisks (stars) are important and must be left in place in order for your key to work. Please only replace the text example.com and leave the rest in place.
If you're using Shopify, you'll also want to add your site's myshopify.com domain, as well as the preview domain Shopify uses for viewing draft themes:
- example.myshopify.com/*
- *.shopifypreview.com/*
Once your list has been modified, it'll look something like this:
Further down the page, leave the API restrictions option set to Don't restrict key:
- Click the Save button at the bottom of the page.
After following the steps above, your Google Maps key should be updated shortly - please note that it can sometimes take up to 5 minutes before the changes are reflected in Google's system. We recommend waiting a few minutes and then confirming that the map on your site shows as expected.
Troubleshooting
My map shows a grey "Something went wrong" error
This often indicates that the list of websites for your key isn't quite correct. Please check:
- That you've added your website to the list in the exact format described above
- That the URL in your browser's address bar matches one of the websites you added to the list in the Google dashboard. For example, this can happen if you're viewing your site's myshopify.com domain but this domain wasn't added to the key.
- That the key you edited matches the key added to Stockist under "Settings > Map provider". The key text is shown at the top of the page (on the right) when editing the key in the Google dashboard.
Still not sure of the issue? Please email us and include a screenshot of your key settings in the Google Maps dashboard, making sure the Website restrictions section of the page is fully visible. We're happy to help confirm if any changes are needed to your key settings.
I can't find my Google Maps key in the Google dashboard
If your key isn't appearing in the list, please try the following:
Check the project selector at the top of the page and try selecting any other projects listed there:
- Try signing into any other Google account that might have been used to create the key
For privacy reasons, Google unfortunately doesn't make it possible to identify which specific email address was used to create a particular map key.
If you're unable to find your key, a simpler option could be to set up Mapbox for your site as a replacement for Google Maps. Your existing store listings and map settings will keep working with Mapbox.
Other questions
If you run into difficulty or have any questions, please get in touch and we're happy to assist. You can use the "Contact us" page of the Stockist dashboard or click "Contact us" in the header of this page.