Tracking Custom Events

Vercel has a track() function that comes with their analytics and events can be used on the dashboard. I would love to see this come to netlify, I use netlify for all my projects and I don’t like using google analytics at all. I would rather have the ability to track a custom event right on netlify. This is something I would also be more than happy to pay for on a pro plan, but at the moment I have cancelled my netlify analytics for two reasons:

1.) I cannot track custom events
2.) I cannot filter bots

The idea for the api is simple

import { track } from '@netlify/analytics';

// Call this function when a user clicks a button or performs an action you want to track
track('Signup');

// or

track('Purchase', { productName: 'Shoes', price: 49.99 });

// or on the server (nuxt)
import { track } from '@netlify/analytics/server';
 
export default defineEventHandler(async () => {
  await track('Item purchased', {
    quantity: 1,
  });
});

While that’s a good feature request, I don’t anticipate this making its way in Netlify (at least any time soon). Here’s why:

  • Netlify Analytics is for server-side logs. As soon as you try to add any client-side functionality, it’s not longer server-side logs. So this would be a big shift in the nature of the product.
  • We don’t have anytime immediately planned to drastically change in the Analytics product.
  • This should already be possible to achieve by storing the data in a database and building dadhboards from that. It’s definitely not ideal and probably too much effort, but it’s possible to achieve this presently.

I understand the points you are making and hopefully someday this will make it’s way to netlify. I really like the platform and netlify edge functions much more than on vercel but the analytics issue is a pain point because google analytics dashboards are not good and having it here on netlify is really nice. I also don’t really feel like migrating over to vercel over analytics, I decided to keep google analytics and stay here but I wish this would be added sometime.

I agree this would be a great addition, so I’ll file it for the devs, but again this is ideally not something you might want to hold your breath for.