WordPress.org

Forums

Maps by Store Locator Plus
[Plugin: Google Maps via Store Locator Plus] Google API sensor error (21 posts)

  1. jeffo.de
    Member
    Posted 2 years ago #

    Hi,
    we have implemented Storelocator Pro Pack and everything works well. But we found one problem, we can't solve and we have posted last week this error already on facebook. Now we found the problem.

    Whenever we access the website's plugin with a regular adsl internet access, the plugin works well.
    But we in Germany do use quite a lot 3G mobile network from vodafone and other carriers. And whenever we are online via 3G online networks, we get an API error, when using Storelocator:

    Your request has been rejected by the Google Maps API server. The value specified in the request "sensor" parameter must be either "true" or "false".

    We found out following:
    The parameter doesn't impact the results. It's a parameter that Google is required to collect for Google's data providers who charge differently based on whether the request uses a sensor or not.

    check out here: here

    The use of sensor has been described by Google here here:

    Unfortunately we couldn't find any information in the plugin's documentation about the sensor. Currently it is not working. Not even on the storelocator's demo site, whenever we use a mobile device.

    What can we do?

    Thanks,
    Jeffo

    http://wordpress.org/extend/plugins/store-locator-le/

  2. jeffo.de
    Member
    Posted 2 years ago #

  3. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    With the Pro Pack there is an option to turn the location sensor on or off. It is off by default in the base product.

    http://www.charlestonsw.com/support/documentation/store-locator-plus/pro-pack-add-on/

    The flag is being passed which means the error is not related to the sensor flag missing. There have been multiple reports of Google in Europe having an unpatched maps server that is not handling the sensor flag properly. A few times in the past week all Google Maps plugins using API version 3 with the sensor flag were throwing errors that magically went away.

    You way want to track the Google Maps forums for the latest discussions about the issue.

  4. jeffo.de
    Member
    Posted 2 years ago #

    Thanks for the fast response.

    We have turned the sensor in the settings on and off. No change of the behaviour. Deactivated and activated plugin. No change.

    It only happens on mobile devices with cell phone carriers. Whenever we use standard dsl-connection from home or office, everything works fine.

    So is the unpatched google maps server responsible for these mobile devices?

    Is there any workaround, as we now get this error on every page of the wordpress installation, not just on the page, where the "SLPLUS" code is integrated?

  5. jeffo.de
    Member
    Posted 2 years ago #

    Ok. And here quick another strange behaviour.
    We connected our mobile devices (Iphone 4 and Ipad 1) via VPN to locations in Germany and the US. The plugin worked fine. We disconnected the VPN-connection but did not a refresh of the page, where the "SLPLUS" code is integrated. Now we were still able to do any search. The plugin worked well. As soon as we refreshed the single page in browser, the error described in the first post came up again.
    Is this really an error in google's data center? Is there only an API sensor check first time I enter the page? Why can I still continue searching until I do a refresh....
    Is there no chance to stop this sensor check in the php-script? For us it would be fine so far to see the google map of Europe as startup. Location check is not really necessary, as long as the plugin can be used with mobile devices.
    Thanks a lot.

  6. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    If you are getting the error on every page then you are running in "early loading" mode for SLP.

    If you have the Pro Pack you can turn off "Force JavaScript Loading" in the Pro Pack section of "General Settings". That will prevent the SLP (and Google Maps) code from loading on every page. However, not all themes work properly with "late loading" (you can read all about this stuff in our blog pages at http://www.charlestonsw.com/).

    As for the sensor issues I will re-check the codebase, but I'm fairly certain the sensor parameter is passed on every call to Google. Other than sending the parameter with an on/off value there is not really any control over the process from our end.

  7. jeffo.de
    Member
    Posted 2 years ago #

    Hi,
    we appreciate really very much your support!

    Well, we are now testing with 3 of 4 mobile network carriers in Germany. All of them show the same error result as described. As soon as we are not using a 3G connection, but the same device (Ipad, Iphone via WiFi) everything works well.

    We have turned off "Force JavaScript Loading" - no change. Same error. We have deactivated all plugins and changed to WordPress standard theme "Twenty Ten". Same error: every website comes up with the error: Your request has been rejected by the Google Maps API server...

    When we deactivate Store Locator - evreything works well.
    We did a clean wordpress install. A fresh install of Store Locator v. 3.3 and upgraded our website's plugin. Same results!

    Our conclusion:
    The error comes from the Store Locator Plugin!

    Reasons:
    1. Error in Google Maps data center
    2. wrong coding with parameters sent to Google
    3. 3G network restrictions (we have tested every Google Maps application with every possible transmittable data - applications from a huge basis of websites tested and no errors): so it is in conjunction with 3G mobile network carriers, but obviously no restrictions apply from the network bearers.

    We use Apple devices for 3G testing. Is it possible, that Googlee Maps is requesting extra data from these devices as they have GPS, compass and other stuff built in? We have no idea about the sensor data being transmitted...

    Everything works really so fine, but with mobile devices the website is not longer accessible thru the Store Locator plugin.

    Maybe you can find something wihin the code.

    We will open support cases with the network bearers on Monday to check, if any data is blocked by them.

    Thanks and best regards from Germany!

  8. jeffo.de
    Member
    Posted 2 years ago #

    Ok once again:

    We found in the sourcescript this alert message from Google:

    Your request has been rejected by the Google Maps API server. The request to be specified \ x22sensor \ x22 parameter must either \ x22true \ x22 or \ x22false \ x22.

    Maybe this helps you to locate our error.

  9. jeffo.de
    Member
    Posted 2 years ago #

  10. jeffo.de
    Member
    Posted 2 years ago #

    Hi, we are still searching for the sensor issue. All mobile providers in Germany told us, that they do not interfere with the internet-traffic, apart from bandwidth, which cannot cause the error. I have copied the html-source code with the error (just the one line with the error). Maybe you can check and see if this error may result from the template? Not sure, if I have copied enough code? I can send you the HTML-Source-File by email.

    else g.fillStyle=style.get('color');renderText();return wrapper;};})());</script> <script type='text/javascript' style="display:none">alert("Ihre Anfrage wurde vom Google Maps-API-Server abgelehnt. Der in der Anfrage angegebene \x22sensor\x22-Parameter muss entweder \x22true\x22 oder \x22false\x22 sein.")</script> <script type='text/javascript' src='http://www.xxx.de/info/wp-content/themes/modernize/javascript/jquery.fitvids.js?ver=1.0'></script> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.xxx.de/info/xmlrpc.php?rsd" /><link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.xxx.de/info/wp-includes/wlwmanifest.xml" /><meta name="generator" content="WordPress 3.4.2" /><script type="text/javascript">var icl_lang = 'de';var icl_home = 'http://www.xxx.de/info/';</script> <script type="text/javascript" style="display:none">function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}

    Translated error message:
    Your request has been rejected by the Google Maps API server. The request to be specified \ x22sensor \ x22 parameter must either \ x22true \ x22 or \ x22false \ x22.

  11. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    In v3.4, A minor change has been made in /include/storelocatorplus-actions_class.php to prepare the Google URL string slightly differently. It should not make any difference whatsoever, but maybe it behaves differently with the .de TLD servers.

    The Google URL is aroudn line 353 in that file and reads something like this:
    'http://'.$sl_google_map_domain.'/maps/api/js?v=3.9&sensor=false'

    While doing the system updates when rendering the map we do use the Location Sensor API calls to turn the sensor on/off in real time as needed, but that is 100% driven using built-in Google API calls and only to set the starting search location. Maybe we need to look at that closer. Try turning OFF use location sensor if you are using the Pro Pack and let me know what happens.

  12. jeffo.de
    Member
    Posted 2 years ago #

    No change whether the location sensor is on or off - we use the Pro Pack.

    I have tried several manipulations of the Google URL - always unsucessful - but not really sure, what I was doing.

    We have to wait for v3.4 to see, if anything will change

  13. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    3.4 was released this morning. I will keep plugging away at this, but it is hard to debug when I can't reproduce the problem.

  14. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    BTW, if anyone wants to send airline tix from CHS to anywhere in Germany and give me a place to stay for a week or two, I'm sure I can figure it out. :)

  15. jeffo.de
    Member
    Posted 2 years ago #

    Well, our office is llocated close to Munich's famouc octoberfest. You have time up to the weekend..... :-) I should better send you some german beer.

    seriously: we are facing the same problem with mobile networks in france now.

    Is there any possibilty to take the code from php script away, that causes the error, whenever we load a single page? For now we have better the website running than the sensor problem and an error on every pave. As long we don't do a refresh, the plugin works perfectly (after once connecting by VPN to a non mobile network).

  16. jeffo.de
    Member
    Posted 2 years ago #

    well, with 3.4 the problem still exists. maybe we
    is there any change to kill the script-parts, that starts on every wordpress page? as soon, as this script does not start, everything is fine. location sensor is disabled.

    maybe you should consider flying to Germany :-)
    or we'll try remote access to a pc, that is connected to a mobile network to debug the problem.

    We really wonder, that noone else is reporting this issue. We wouldn't have tested on a mobile network, if we wouldn't have started to develop a template for mobile access, too. Maybe everybody should test this issue only from their mobile phones (not connected via WiFi, use 3G connection).

  17. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    Have you tried turning on/off "force load javascript" in the Pro Pack (this will be a standard feature in v3.5 btw).

    Is location sensor is not checked then the sensor settings should always be coming back false & Google Gears is not loading so it should be working ok.

  18. jeffo.de
    Member
    Posted 2 years ago #

    Unfortunately no change. Not even with the latest firmware. Our Webdamin just told me, he had this issue with another project already and tries to find out, what the problem was. Something with the vers.3 sensor. I will keep you updated, as soon as we found the solution.

  19. jeffo.de
    Member
    Posted 2 years ago #

    Well, our webadmin with real code experience could solve the problem really fast. Here is, what he did:

    path: wp-content/plugins/store-locator-le/include
    file: storelocatorplus-actions_class.php
    lines: 415 – 418 (417)

    -----------------------
    wp_enqueue_script(
    'google_maps',
    'http://'.$sl_google_map_domain.'/maps/api/js?v=3.9&key='.$api_key.'&sensor=false'
    );
    -----------------------

    'http://'.$sl_google_map_domain.'/maps/api/js?v=3.9&key='.$api_key.'&sensor=false'

    Apparently the "&" output is not correctly. The browser displays "# 0348," instead of "&".

    He has changed the first line and "& sensor = false" in first place after the set '? "

    http://'.$sl_google_map_domain.'/maps/api/js? sensor=false'&v=3.9&key='.$api_key

    Probably that solved the problem already - but he still tried to reach a recoding to have a better result from the upper block like here:

    ----------------------------
    $GoogleM_url = urldecode('http://'.$sl_google_map_domain.'/maps/api/js?sensor=false&v=3.9&key='.$api_key);

    wp_enqueue_script(
    'google_maps',
    '' . $GoogleM_url . ''
    );
    --------------------------

    With this solution the plugin now works well on all networks. No more Google API-errors. We are very happy now.

    Maybe you can take care about this issue for further releases, we would be very glad. If you can confirm this topic please, I would mark this topic then as resolved!

    Best regards from Germany.

  20. Store Locator Plus
    Member
    Plugin Author

    Posted 2 years ago #

    I'm moving the sensor parameter to the "front" of the string just after the ?. That will help fix this problem for sites that are not operating in a standard environment.

    Default WordPress installation will not encode the URL passed to wp_register_script() or wp_enqueue_script. I just read the entire call stack for both functions and there is no inherent string manipulation going on with the source URL.

    My guess is a PHP setting, a WordPress plugin, or WordPress theme is active and adding a text filter and mangling the URL. That would explain why it is nearly impossible to reproduce this issue on any of our servers.

    Doing this:
    wp_enqueue_script('test','http://a.b.com/blah?x=1&y=2');

    Should NOT end up with the URL being called as:
    http://a.b.com/blah?x=1#0384y=2

    The only reason & would be translated to #0384 instead of &amp (which would be a normal default encoding) is because a special language filter is catching the URL. A smart language filter should NEVER change a URL string like that. #0384 is NOT the accepted international replacement in a URL string for &.

    Why wrapping urldecode() around the string changes the behavior is also suspect, so I left that part out. On "vanilla PHP", the two strings are identical:

    $x = 'http://a.b.com/blah?x=1&y=2'

    and

    $y = urldecode('http://a.b.com/blah?x=1&y=2')

    and

    $z = urldecode($x)

    return the exact same string.

    Passing $x, $y, or $z to wp_enqueue_script() should be returning the same exact result in all 3 cases. My guess is this is having zero impact and the only thing that fixed the issue was putting ?sensor=false first. This forces that required parameter to be put first, before your language filter mangles the URL.

    I only share all this with you because something odd is going on with your install and there are likely side effects you are not aware of. Hopefully nothing serious, but mangling URLs can cause issues even if they are not visible including warnings filling up log files and degrading system performance. Also, the API version in our URL with Google (v=3.9) is not critical today, but who knows if/when Google will change their mind on that, at which point I'm guessing this "fix" will not work.

    Thanks for sharing your findings & giving me the info to improve the plugin!

  21. Ifiok Jr.
    Member
    Posted 2 years ago #

    I'm having the same problem as described above - where anytime I access my site I receive this error. <i>The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false".</i>

    <b>Basic Information:</b>

    • I don't have the Pro version, as I'm currently testing out the plugin, before diving in.
    • I've tried turning off other plugins as well as the ones using google maps and it still comes up.

    I've had a look at storelocatorplus-actions_class.php and noticed that in the newer version of the plugin (which I have) you've already made the changes outlined above. I've even tried going a step further and using a variable as mentioned by the previous poster.

    None of it seems to work and the source code for my website just reads:
    <script type='text/javascript' src='http://maps.google.co.uk/maps/api/js'></script>

    Nothing after the js? is being passed through by the wp_enque_script()

    I can turn off the error using the option <i>Turn Off SLP Maps</i> but that's not really useful to me since the maps stop showing.

    One thing that did peak my interest was some code I noticed in the file storelocatorplus-actions_class.php

    <i>`//todo:character encoding ???
    //"http://$sl_google_map_domain/maps?file=api&v=2&key=$api_key&sensor=false{$sl_map_character_encoding}"</i>

    I would have tried to implement it myself but I'm not so confident that I know exactly what it is I'd be trying to do.

    I have a strange server set-up (using AWS) so perhaps part of the security is removing characters from the wp_enque_script(...) - any pointers in the right direction, or amazing solutions would be much appreciated :)

    If you need the website just let me know.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Maps by Store Locator Plus
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic