• tsoto111

    (@tsoto111)


    Hello, I am trying to optimize the charges hitting my Google Maps API key. As a result, I thought I could prevent the Google Map from being loaded into the DOM of the web page by creating a button that would dynamically load the Google Map with markers into the DOM on button click.

    As a result, I tried creating a custom Map Template within my custom WordPress theme. The first thing I tried to do was remove the following map element from the template to see what happens.

    $output .= "\t" . '<div id="wpsl-gmap" class="wpsl-gmap-canvas"></div>' . "\r\n";

    After refreshing the page, my list of Restaurants disappeared alongside my map even though the #wpsl-result-list elements were left untouched.

    Is what I am attempting to do not possible with this plugin? If the Restaurant posts depend on the map being rendered in order to know what its data is going to be… then I can’t prevent the Google map from being rendered in the DOM and expect the posts to function the same way as it does when the map is present… right?

    Once again, the reason I want users to control the loading of the map into the DOM is to optimize the Google Map API charges I am receiving by always rendering the map. Logically, I don’t want the map to render unless the user chooses to interact with it.

Viewing 5 replies - 1 through 5 (of 5 total)
  • farroyo

    (@farroyob)

    Hi there,

    This is a very reasonable concern and I’m happy to tell you that we are working on it. The upcoming v3.0 will include, for example, an option to display a static image in the map area until a search is made, reducing the cost of the API request made on page load.

    Version 3.0 is actually in beta, if you want to try it out reach us through our Contact page.

    Regards,

    Thread Starter tsoto111

    (@tsoto111)

    @farroyob, THIS IS GREAT NEWS! I have posted in your contact form for the beta version of this functionality. That being said, do you guys possibly have an estimate of when version 3.0 is released?

    This will help me advise my client on whether or not it is worth it to wait. Otherwise, I will be forced to implement an “external” custom solution.

    farroyo

    (@farroyob)

    Hi again, I replied your support ticket.
    Regards,

    Thread Starter tsoto111

    (@tsoto111)

    Hi Farroyob,

    Sorry for the late reply. We actually reviewed the beta logic with the client and this wasn’t the user experience he was looking for. During my POC, I noticed that the “Restaurant Locations” are still tied to the “Google Map”. As a result, when I enabled the new setting it did render the “load map” button instead of the full map. But, it also hid the “Restaurant Locations”.

    My client actually wants a view where the map is replaced by the “load map” button while the restaurant locations are still listed in the view. Once a user clicks the “Load Map” button… then the google map would load with all of the markers. In short, the filter and restaurant posts would always be present and functional. The google map logic would be optional.

    All that being said, this is just a suggestion to improve the UX/UI of this plugin. What you guys have is AWESOME, but this addition would make it even better. They are still using the plugin, but in the future I can still see them having me re-build the site’s restaurant logic directly into the theme just to get the optimization of google map API requests.

    Cheers,
    – Tavo

    farroyo

    (@farroyob)

    Hi again,

    That’s a good point, I will make sure to pass it on to the dev team for their consideration, they always welcome feedback that can make the plugin better!

    Regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Load Google Map on Click’ is closed to new replies.