Track custom actions with netlify analytics

I started using netlify analytics and got rid of the google analytics scripts on my site, I just wanted to know if there is a way to track certain actions, for example how many times someone clicks a share button on a blog post. I would probably still keep netlify analytics because the charts are better, but if these types of actions aren’t supported it seems it’s still necessary to import google analytics library.

@dbzx10299 Here’s an explanation for how Site Analytics works:
https://docs.netlify.com/monitor-sites/site-analytics/how-site-analytics-works/

It’s based on the server logs and as such isn’t intended to be a complete replacement for all use cases of something like Google Analytics.

There is no event tracking.

You could probably abuse the default tracking to get a rudimentary version going by adding your own JavaScript that makes a request to a URL when the user performs the desired action.

E.g. When they click the share button, it makes a request to /share/blog-post-slug which would in turn be tracked.

Vercel observability has a track() api and I would love to see something like this come to netlify. One other thing I noticed is that the bots traffic is not filtered out and I was getting higher numbers with my traffic. Maybe these two things could be requested features

That’s a long standing known issue as per this thread:
https://answers.netlify.com/t/over-100x-more-views-in-netlify-analytics-than-google-analytics/15403

You can add your own feature-request’s to the Features section.
Just make sure to do a quick search first to see if it’s a duplicate request, if there’s an existing one you can ‘like’ it and comment on it to effectively +1 it.