v0.10.0: Next.js Server Auto-Initialization
This release dramatically improves the Next.js integration by introducing zero-config server tracking and fixing critical compatibility issues between client and server environments.
✨ New Features
🚀 Zero-Config Server Tracking
# Just set environment variables - no manual initialization needed!
NEXT_PUBLIC_BA_SITE=my-app// API Routes - works automatically
import { trackServer } from "better-analytics/next";
export async function POST(request) {
// ✨ Auto-initialized from env vars!
await trackServer('api_call', { endpoint: '/users' }, { request });
}
// Server Actions - works automatically
'use server';
import { trackServer, identifyServer } from "better-analytics/next";
export async function createUser(formData) {
await identifyServer('user123', { email: formData.get('email') });
await trackServer('user_signup', { method: 'form' });
}