Skip to content
← Back to Changelog

Friday, October 6th 2023

Track server-side custom events with Vercel Web Analytics

Posted by

Avatar for chriswdmr

Chris Widmaier

Engineering Manager

Avatar for tobias

Tobias Lins

Software Engineer

Vercel Web Analytics now supports tracking custom events on the server-side, in addition to existing support for client-side tracking.

import { track } from '@vercel/analytics/server';
export default function FeedbackPage() {
async function submitFeedback(data: FormData) {
'use server';
await track('Feedback', {
message: data.get('feedback') as string,
return (
<form action={submitFeedback}>
<input type="text" name="feedback" placeholder="Feedback" />
<button type="submit">Submit Feedback</button>
Tracking a server-side event with a Server Action in Next.js.

Events can now be tracked from Route Handlers, API Routes, and Server Actions when using Next.js (or other frameworks like SvelteKit and Nuxt) through the track function.

Custom event tracking is available for Pro and Enterprise users.

Check out the documentation to learn more.