API

Page meta

Configure automatic router pageviews with definePageMeta.

The module extends Nuxt page meta with mixpanel.pageview. These settings apply to automatic pageviews when client.pageviewStrategy is 'router'. They do not affect Mixpanel native tracking or manual track_pageview() calls.

Usage

app/pages/reports.vue
<script setup lang="ts">
definePageMeta({
  mixpanel: {
    pageview: {
      properties: { section: 'reports' },
    },
  },
})
</script>

See Pageviews for integration examples.

Type

interface MixpanelPageMeta {
  pageview?: false | {
    properties?: Record<string, unknown>
  }
}
Type import
import type { MixpanelPageMeta } from 'mixpanel-nuxt/config'

MixpanelPageMeta is the type of the mixpanel field in page meta.

Fields

FieldTypeDefaultBehavior
pageviewfalse | { properties?: Record<string, unknown> }Unsetfalse excludes the route and its children from automatic pageviews. An object supplies pageview properties.
pageview.propertiesRecord<string, unknown>UnsetProperties merged into the automatic pageview before the runtime hook runs.

Page meta does not enable tracking. Enable pageviews through the client configuration.

Inheritance

Properties are merged from parent to child routes. A child replaces a parent's property with the same key.

If any matched route sets pageview: false, the route is excluded. A child cannot re-enable tracking disabled by its parent. The mixpanel:pageview hook is not invoked for excluded routes.

The module adds route_name before merging page properties. Page meta can replace that property, and the pageview hook can replace properties supplied by page meta.

Apps without a pages/ directory have no page meta or generated route_name.

Copyright © 2026