Google Maps V3 “Sensor Parameter” Error – Cause and Fix

If you are here you probably received an error something like this:

The Google Maps API server rejected your request. The “sensor” parameter specified in the request must be set to either “true” or “false”.

This is a commonly seen error message when working with the Google Maps V3 API. If you are like me, you know little about javascript and find the lack of beginner-level support for the Google Maps API absolutely infuriating. The tutorials put out by almost everyone including Google itself pertaining to even the most basic functions make everything sound so complicated and actually leave out some of the steps, assuming you are just going to figure it out on your own. I plan on posting a few times about Google Maps v3 API with some simple tutorials and How-To’s with examples of some basic functions you can do. Until then, the solution to this problem. In my case, I got this error because I was careless. I expected some example code from Google to just WORK. But it doesn’t. And since I don’t know a lot of Javascript, I didn’t want to try and proof all the code. So I Googled the aforementioned error message, only to find nothing. I was running an example from Google’s own tutorial on how to use the maps. You can find this tutorial here. If you have this line of code, this is your problem:

Tired of dealing with your slow WordPress website? Email me at brian@pagecrafter.com and mention the code #FreeHosting10 for two free months of lightning-fast WordPress hosting. We will even migrate you for free!

If you look closely at that link, there is a big part that says, “YOUR_API_KEY” and another part after “sensor” that says “SET_TO_TRUE_OR_FALSE.” Guess what you need to do? Simply enter in your API key and set the other value to either true or false. What that setting is, is just a feature that can use the GPS in the device used to access the page to generate the  map. So if you set it to true, a mobile visitor may be able to see their own location on the map. But that’s all you have to do! It’s obviously pretty basic, but I can’t be the only one with this problem. Some of you trying to do more elaborate things may get this error message as well for different reasons. My guess is if you are seeing it, somewhere the “sensor” parameter is being mentioned but never defined properly. I have heard it can be case sensitive as well, make sure you do it all lower case. Hope this helps!

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.

4 Comments on “Google Maps V3 “Sensor Parameter” Error – Cause and Fix”

    1. This is an error caused by configuring your settings for Google Maps wrong on your own website. If you are getting this error on someone else’s site, then it’s a problem with that website that they would need to fix. Or if you are using some sort of plugin or something, it’s possible it’s a problem with the plugin.

      Normally the code is just in the header of your site, but you would have had to put it there, in which case I guess you would normally know where to look for it…

Leave a Reply

Your email address will not be published. Required fields are marked *