Vue.js (coming soon)
Plugin Setup

Plugin Setup

⚠️

Not available yet. TracePath does not publish a Vue package, so nothing on this page can be imported or run today. It documents the planned plugin. See OpenTelemetry for the integration path that works now.

The plugin is the single setup point for a Vue 3 app: it initializes the SDK, provides the client through Vue's injection system, and installs the global error handler.

Plugin options

OptionTypeRequiredDescription
connectionStringstringYesProject token and ingest endpoint
optionsobjectNoSDK configuration, see below

SDK options

OptionTypeDefaultDescription
debugbooleanfalseLog dropped events and failed uploads to the console
debounceMsnumber1500Batch delay in milliseconds
retryDelayMsnumber10000Retry delay for failed uploads
versionstringundefinedYour application version
ignoreErrorsArray<string | RegExp>built-in defaultsError patterns to suppress. An empty array captures everything. See Error Filtering
beforeCapture(exception) => booleanundefinedReturn false to suppress an error
sessionRecordingbooleantrueEnable the rrweb session recorder
sessionRecordingSegmentDurationnumber30000Segment length in ms
recordAllSessionsbooleanfalseAlways-on session recording. See Sessions
captureLogsbooleantrueMirror console.* calls into the rolling log buffer
captureNetworkbooleantrueRecord fetch / XHR calls as network actions
captureNavigationbooleantrueRecord History API push / replace / pop transitions

Error handling

The plugin assigns app.config.errorHandler, which is how component render errors, watcher errors and lifecycle hook errors reach TracePath.

Vue has exactly one such slot. If your application assigns its own handler after the plugin is installed, it silently replaces TracePath's and those errors stop being reported — uncaught errors and unhandled rejections keep flowing, so the feed looks alive while a whole category of errors has gone missing. To keep both, install the plugin first and then, inside your own handler, call the package's exported capture function yourself before doing whatever else your handler does.

Environments

Use a separate TracePath project, and therefore a separate connection string, per environment. In a Vite app that means a VITE_-prefixed environment variable read at build time; the token is public by design, since it only grants ingest for that one project.

Custom attributes

App-level identifiers — userId, tenant, feature flags — will be bindable three ways:

  • A composable taking a getter, so it tracks reactive state, pushes only the keys that changed, and removes the keys it owns when the component unmounts. Returning null means "empty map", which is the useful state while user data loads or after logout.
  • A declarative component doing the same thing, rendering nothing, cleaning up on unmount.
  • Plain imperative functions, for code outside components.

Treat every key passed to the composable or the component as owned by it: setting the same key imperatively elsewhere means the unmount cleanup removes a value the other side still expects. When driving the scope imperatively from a watchEffect, remove keys individually rather than clearing the whole scope — clearing empties the global scope and drops keys set by unrelated parts of the app.

Layering on each event is defaults < global scope < per-call. See Sessions for the full attribute model.

Nuxt

In Nuxt 3 the plugin file must run universally — plugins/tracepath.ts, not plugins/tracepath.client.ts. A .client plugin never runs during SSR, so the injection key is missing on the server, and the first component that calls the composable fails the render with an HTTP 500.

Running universally is safe: the plugin only installs the browser handlers and the recorder when window exists, so the server pass does nothing except provide the injection key.

Related