Page meta
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
<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>
}
}
import type { MixpanelPageMeta } from 'mixpanel-nuxt/config'
MixpanelPageMeta is the type of the mixpanel field in page meta.
Fields
| Field | Type | Default | Behavior |
|---|---|---|---|
pageview | false | { properties?: Record<string, unknown> } | Unset | false excludes the route and its children from automatic pageviews. An object supplies pageview properties. |
pageview.properties | Record<string, unknown> | Unset | Properties 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.