useMixpanelServer
useMixpanelServer() returns the Node SDK instance used by Nitro. It is auto-imported in server routes, plugins and utilities.
Usage
const mixpanel = useMixpanelServer()
For an explicit import:
import { useMixpanelServer } from '#mixpanel/server'
Type
function useMixpanelServer(): MixpanelServer
import type { MixpanelServer } from 'mixpanel-nuxt/config'
Return value
MixpanelServer exposes the Mixpanel Node SDK. The instance is initialized on first use and reused by subsequent calls.
SDK methods retain their callback signatures. The module does not convert them to Promises. See Nitro for a handler that waits for delivery.
Shared state
User identity must be supplied with each operation. The shared instance must not hold request-specific identity or properties.
Availability
Server tracking is enabled by default. Calling the accessor when server.enabled is false throws. The server token is independent of the browser token.
Node and serverless Node are supported; edge presets are not covered.