Configuration

Easily configure this module in Nuxt's config file

This module can be configured using Nuxt config:

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-posthog'],
  posthog: {
    // Configure `nuxt-posthog` module
  }
})

Options

publicKey

PostHog's API key. By default it will read POSTHOG_API_KEY environment variable from .env.

host

PostHog's API host. By default it will read POSTHOG_API_HOST environment variable from .env.

capturePageViews

Default to true. It will automcatically capture page views.

capturePageLeaves

Default to true. It will automcatically capture page leaves.

clientOptions

Additional options passed to PostHog's client object.

disabled

Default to false. If set to true, the module will be disabled (no events will be sent to PostHog). This is useful for development environments. Directives and components will still be available for you to use.


Copyright © 2024