Features
PreviousNext

Analytics

Tools to track user behavior and events using different analytics providers.

In this page, we will see how to setup analytics in your application.

Installation

Make sure that the @kit/analytics package is installed.

pnpm add '@kit/analytics@workspace:*'

Set your analytics config file to select your provider.

config/analytics.config.ts
import { createAnalyticsManager } from '@kit/analytics';
 
export const analytics = createAnalyticsManager(['google']);

Check the page documentation of your provider to see how to set the environment variables.

Environment variables

# ============================================
# 📊 ANALYTICS
# ============================================
 
# For Google Analytics
NEXT_PUBLIC_GA_MEASUREMENT_ID=G-XXXXXXXXXX
NEXT_PUBLIC_GA_DISABLE_LOCALHOST_TRACKING=true
NEXT_PUBLIC_GA_DISABLE_PAGE_VIEWS_TRACKING=false
 
# For Umami
NEXT_PUBLIC_UMAMI_HOST=https://your-umami-instance.com
NEXT_PUBLIC_UMAMI_WEBSITE_ID=1234567890
NEXT_PUBLIC_UMAMI_DISABLE_LOCALHOST_TRACKING=true

How is this guide?

Last updated on 2/1/2026