No API Key warning on embedded Google Map


#1

Hi,

I have an embedded google map on page http://www.bnasmartpayment.com/contact-us that’s showing an error on the screen and these error messages in the consoles:

Google Maps API error: MissingKeyMapError

Google Maps API warning: NoApiKeys

Google Maps API warning: SensorNotRequired

I know I need a new API key but I don’t know where to put this code in my custom HTML module. Please give some guidance.

Thanks,
Christina


#2

@c.gooyers that’s a google maps error, you’ll need to go to their forums/documentation to determine where to get a new api key. They actually linked to the relevant docs in the error:

https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error

Here is info on getting a new API key:

https://developers.google.com/maps/documentation/javascript/get-api-key

Sebastian


#3

Hi Sebastian,

Thanks for getting back to me, although the problem isn’t finding an API
key, I already had one I’m just not sure where it needs to go in the custom
HTML module. Are you able to shed any light on this?

Thanks,
Christina


#4

Hey Christina,

I haven’t played with Google Maps API too much but it looks like if you open up your custom module, on line 24 you should add

&key=YOUR_API_KEY to

script.src = "https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize";

so it looks like this

script.src = "https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize&key=YOUR_API_KEY";

See further instruction here

Sebastian