GoLiveKit
Analytics

Overview

Learn how to use analytics in GoLiveKit.

GoLiveKit comes with a generic analytics module located at src/lib/analytics. It is designed to be provider-agnostic while currently having first-class support for Google Analytics.

Features

  • Centralized Provider: An AnalyticsProvider component handling initialization logic.
  • Provider Agnostic: Easily extensible to support Plausible, PostHog, or other services.
  • Custom Events: Utilities to track user interactions.

Supported Providers

Initialization

The analytics provider is automatically included in the root layout:

src/app/[locale]/layout.tsx
import { AnalyticsProvider } from '@/lib/analytics/analytics-provider';

export default function Layout({ children }) {
  return (
    <html>
      <body>
        {children}
        <AnalyticsProvider />
      </body>
    </html>
  );
}

Adding a New Provider

To add a new analytics provider:

  1. Create a definition file in src/lib/analytics/provider/.
  2. Update src/lib/analytics/analytics-provider.tsx to include the new provider component conditionally.

On this page