HowTo – marker visit/click statistics using Google Analytics

New home Forums Basic Version General queries HowTo – marker visit/click statistics using Google Analytics

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #69915

    Hi, this is not a question but rather a HowTo for others in case they’ll also have similar business requirement like I did. Might save you few hours of analyzing the options 🙂

    I needed to implement some marker viewing/opening statistics in order to observe, which markers are more popular than the others etc. I knew it had to be implemented within the Custom JS code section within the “infowindowopen” event listener, but I did not know how to transfer that information to my database. First I was thinking I needed an extra REST service to be called from jQuery, but yesterday I received a great tip and it works so I decided to share it with you… I just interconnected the mentioned listener with Google Analytics and now I can nicely observe it in my Google Analytics Console!

    So just in case you need similar functionality, just add this code to your custom JS section within the WP Google Maps plugin (beforehand you have to add GA to your website – see

    jQuery(function ($) {
        $(window).on("infowindowopen.wpgmza", function (event) {
            var marker =;
            ga('send', {
              hitType: 'event',
              eventCategory: 'Marker',
              eventAction: 'Open',
              eventLabel: + ' ' + marker.title

    Good luck!

    PS: I had a problem with the free version of MonsterInsights plugin, which was blocking the events sent directly to GA. Had to deactivate it and add the Google Analytics support manually using the “Insert Headers and Footers” WP plugin.


    Hi there,

    Thank you so much for posting and sharing this information on the forum, we really appreciate it!

    We are happy that you have found a solution for your needs and that it is working great.

    We hope that you are enjoying WP Google Maps and that it is serving you well!

    Kindest Regards


    Do you have information on how to get this working with the new Google Analytics v4?

    I tried this above and I can see the event trigger in the browser console. But I am not seeing the event show up in Universal Analytics or the new GA4.

    Do you have a setup guide to get analytics working with wpgmaps? or an addon for analyics?

    My customer wants to track which dealers are clicked on the most in the map and in the list.
    please advise.

    • This reply was modified 1 year, 12 months ago by lucein.

    Hi Doug,

    Thank you for getting back in touch, we do appreciate your time.

    Unfortunately we currently do not have any analytics features for WP Google Maps, however, we may look into this in the future.

    We do apologize for any inconvenience this may have caused.

    Kindest Regards,




    Hi @Nimbbl,

    How may we help?

    Kindest Regards,

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.