Add New Venue geolocation fails if WordPress Address uses .scot

WordPress Event Management, Calendars & Registration Forums Report A Bug Add New Venue geolocation fails if WordPress Address uses .scot

This topic contains 4 replies, has 2 voices, and was last updated by  Stephen Harris 8 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23892

    Hi Stephen, we have encountered an issue with Add New Venue failing to geolocate venue addresses when the WordPress Address uses .scot.

    Users can enter Venue Location meta but the viewport and marker remain at 0,0 and the marker must be manually dragged into place.

    Add New Venue successfully geolocates venue addresses when the WordPress Address is set to .com and Site Address remains .scot, so we have implemented this as a workaround.

    Example Net traffic for .com:

    GET 
    https://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent [HTTP/2.0 200 OK 63ms]
    GET 
    https://maps.googleapis.com/maps-api-v3/api/js/26/1/geocoder.js [HTTP/2.0 200 OK 11ms]
    GET 
    https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 89ms]
    GET 
    https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 40ms]
    GET 
    https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo [HTTP/2.0 200 OK 64ms]
    GET 
    https://maps.googleapis.com/maps/gen_204 [HTTP/2.0 204 No Content 21ms]
    GET 
    https://maps.googleapis.com/maps/api/js/StaticMapService.GetMapImage [HTTP/2.0 200 OK 189ms]
    GET 
    https://maps.googleapis.com/maps/vt [HTTP/2.0 200 OK 80ms]
    

    for .scot:

    GET 
    https://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent [HTTP/2.0 200 OK 58ms]
    GET 
    https://maps.googleapis.com/maps-api-v3/api/js/26/1/geocoder.js [HTTP/2.0 200 OK 11ms]
    GET 
    https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 71ms]
    GET 
    https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 111ms]
    GET 
    https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 61ms]
    GET 
    https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 112ms]
    GET 
    https://maps.googleapis.com/maps/api/js/GeocodeService.Search [HTTP/2.0 200 OK 32ms]
    GET 
    https://csi.gstatic.com/csi [HTTP/2.0 204 No Content 111ms]
    

    scot appears not to generate calls to

    https://maps.googleapis.com/maps/api/js/ViewportInfoService.GetViewportInfo

    https://maps.googleapis.com/maps/gen_204

    https://maps.googleapis.com/maps/vt

    Help appreciated, thanks – David

    SRUC Webmaster
    #23893

    Hi David,

    I’ve just tested this on a .scot domain and it worked without any issue (I used a local VM and edited by hosts file – but the site url, which would be used by Google was a .scot domain – I checked this by changing the Google API key conditions just to make sure that Google was using the site url I expect it to).

    With regards to the plug-in it just loads the Google Maps API (v3) and then uses the API. It doesn’t provide the site url (or domain) to Google, but Google will collect that information when using the maps API. In short – there’s nothing in the plug-in to fix here. All the urls listed above are automatically loaded by Google as part of its API.

    My only thought would be that you have a Google maps key that is only valid for your .com domain (I’m assuming that the .com and .scot sites are actually one and the same). However, testing this, I see a grey ‘map’ and an error message.

    Stephen Harris
    #23895

    Hi Stephen, thanks for the quick reply.

    The “Accept requests from these HTTP referrers (websites) (Optional)” field for the API key is empty. Like you say, if there is a referrer set here, and it doesn’t match the domain, then a grey box and an error is displayed in place of the map.

    What we’re seeing here is that whereas changes to Venue Location meta fields in the Add New Venue screen are usually accompanied by an immediate refresh of the map centred on the location entered by the user, with the .scot domain used for WordPress Address, no refresh happens. The map remains centred on lat 0 lon 0, e.g. https://www.google.co.uk/maps/@0,0,9z

    We are using WP Engine, who have a ton of caching and CDN stuff in place. Since WordPress Address ending .wpengine.com works but .scot does not, I’m going to ask their support for assistance here.

    SRUC Webmaster
    #24436

    Hi Stephen, I’ve resolved the issue. Posting this in case it helps anyone else.

    Looking at the browser’s console log when adding a location via /edit.php?post_type=event&page=venues&action=create showed an “This API project is not authorized to use this API.” message.

    Sure enough, the Google API Console for this project showed I had enabled the Google Maps JavaScript API https://console.developers.google.com/apis/api/maps_backend/ but not the Google Maps Geocoding API https://console.developers.google.com/apis/api/geocoding_backend/

    Once the Google Maps Geocoding API was enabled, the issue disappeared and adding a location behaves as expected.

    We encountered this issue on the live domain (.scot) but not when using the development domain – since the development domain predates Google’s API key rule, the “missing” API caused no issue.

    However for new domains, both the Google Maps JavaScript API AND the Google Maps Geocoding API need to be enabled.

    https://developers.google.com/maps/documentation/javascript/geocoding does mention this, but it’s not made clear simply from reading https://developers.google.com/maps/documentation/javascript/get-api-key

    Regards, David

    SRUC Webmaster
    #24494

    Hi David,

    Thanks for getting back to me. I hadn’t realised that the Maps API and Geocoding API were considered separate services.

    Stephen Harris
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.