pkmnct / qualtrics-google-map-lat-long

Embed a customizable Google Map in your Qualtrics survey to collect location data
MIT License
21 stars 13 forks source link

Issue with key #7

Closed cnaptik closed 5 years ago

cnaptik commented 5 years ago

I get the following message after running the script:

Google Maps JavaScript API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys

My key is activated, no restrictions billing is enabled on Google Cloud Platform, and the key is inserted into the script. Could the issue be related to the application being writen for API v2?

Google's troubleshooting page reports the following:

NoApiKeys Warning The script element that loads the API has no API key. Please make sure you include a valid API key as a key parameter. You can generate a new API key in the Google Cloud Platform Console. See Get an API key. If you are loading Maps JavaScript API from the deprecated v2 path with an old v2 key, you will get the NoApiKeys warning, even if you specified the key parameter. Please check the v2 to v3 upgrade guide and migrate your application to Maps JavaScript API v3.

https://developers.google.com/maps/documentation/javascript/v2tov3

pkmnct commented 5 years ago

@cnaptik The script is using v3 of the Google Maps API. If you are using the Autocomplete field, make sure your API key has access to the Places API:

The map or autocomplete field search shows "This page can't load Google Maps correctly" or "For development purposes only"

This usually indicates an issue with your API key. Make sure you set the API key variable. Check that the API key has access to both the Maps JavaScript API, and if you are using the Autocomplete Field, the Places API. If you are still having trouble, follow Google's API key troubleshooting steps.

Additionally, make sure you only inserted the key in the variable on line 17, nowhere else in the code.

cnaptik commented 5 years ago

Thanks a lot for your very prompt answer!

It is now working. The problem was that I had inserted the key on both line 17 and line 148.