Add a counter to see how often a popup has been clicked

A simple counter next to each popup in the dashboard would be helpful. It would be even cooler if it would also show the impressions, so that the impression/click ratio can be calculated (similar to eg Thrive Leads)

2 Likes

Folks, our former Wishlist portal, where our users shared their requests and suggestions, was transferred to this forum. You’re most welcome to vote, add new ideas, and leave your comments here — we surely will consider them all! :star_struck:

Original Votes: 3

Hi @Info96 :wave:

We are happy to tell you that you can track the number of popup clicks with the help of Google Analytics code.

Please add this part of the code to your website :

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-ID "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-ID ');
</script>

In the code above, you need to replace UA-ID with your actual website ID for Google Analytics. If you are using Google Analytics 4, you need to use G-ID instead of UA-ID (see screenshot). This article will help you find your ID - Find your Google tag ID.

And then just add the rest of the script right before closing tag:

<script>
function eappsDispatchAnalyticsEvent(event, selector, config) {
  function sendEvent(config) {
    if (typeof ga !== "undefined") {
      ga('send', 'event', {
        eventAction: config.action,
        eventCategory: config.category,
        eventLabel: config.label
      });
    }
    if (typeof gtag !== "undefined") {
      gtag('event', config.action, {
        'event_category':  config.category,
        'event_label':  config.label
      });
    }
  }
  function isHitClass(e, selector) {
    return e.target && e.target.closest(selector)
  }
  if (isHitClass(event, selector)) {
    sendEvent(config);
  }
}
document.addEventListener('click', function (event) {
  eappsDispatchAnalyticsEvent(event, '[class*="Content__Container-sc"]', {
    action: 'click',
    category: 'Popup',
    label: 'Click on Elfsight Popup'
  });
}, true);
</script>
1 Like

A post was split to a new topic: Google Analytics for Popup doesn’t work

This feture is very important for our website SocialKing.in

2 Likes

Welcome to the Community and thanks for upvoting the idea, @Shubham_Shubh_Gupta :wave:

We agree that it would be amazing to have such a counter right in the dashboard, but as a workaround, you can track clicks using the Google Analytics code from the message above.

Feel free to test it out :wink: