Google maps: ensuring referrers are properly setup

Incorrectly inserting your referrers in your Google Map API project can result in your map not being properly displayed. You’ll find an error message from the Google Maps API ( RefererNotAllowedMapError) in the JavaScript console of your website.

To fix the issue, log back into the Google API Manager. (Note: If you haven’t set up a Google Maps API project for your website, please see this article for detailed instructions.)

The referrers are set in the Credentials. Click Credentials in the right-hand column in the Dashboard. Then click the Pencil icon to the right of the API key for your Google Maps project.

You'd want to restrict access to your API Key to avoid having it being "stolen" by other websites and going over your quota. Click on the api key you've created to edit it's restrictions settings.

Select HTTP referrers (web sites) and enter the following domains under Accept requests from these HTTP referrers (web sites) replacing yourdomain.com with your domain name.

*yourdomain.com/*

Replace example.com with your real domain name:

  • *.example.com/*
  • *example.com/*

Please note that the Google Maps API is very specific about how domains should be formatted – please use exactly that format.