Would be very useful to have stats how often the specific content etc. was shared with a specific social media share button.
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!
Original Votes: 1
Hello,
Thanks a lot for adding your idea!
For me to understand it a bit better, do you mean that you’d love to display a number of how much time the share button was pressed? Please check out this feature request for reference - Add counter and total counter to share buttons. | Feature Wishlist.
Thank you and looking forward to your reply!
This feature suggestion is years old, but I was coming in to request this same feature.
As we have this on our blog posts, we would love backend stats on what links were shared and how often.
Hi there, @andreavlj
Unfortunately, this feature isn’t available in our app yet. But the good news is that you can track button clicks using the Google Analytics code as a workaround. To do this, add this part of the code to your website <head>
:
<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 </body>
tag:
<script>
function sendAnalyticsEvent(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
});
}
}
document.addEventListener('click', function (event) {
const button = event.target.closest('.eapps-social-share-buttons-item');
if (button) {
sendAnalyticsEvent({
action: 'click',
category: 'Elfsight Social Share Buttons',
label: button.title
})
}
}, true);
</script>
Feel free to test this code and let us know if it worked