Skip to main content
The Sentry Vue SDK provides error tracking and performance monitoring for Vue.js applications (Vue 2 and Vue 3).

Installation

Basic Setup

Initialize Sentry before creating your Vue app:

Vue-Specific Features

Error Handler Integration

Automatically captures Vue component errors:

Component Tracking

Track specific component lifecycle events:

Vue Router Integration

Automatic route change tracking:

Pinia Integration

Track Pinia store actions:
This will:
  • Attach store state to error events
  • Create breadcrumbs for store mutations
  • Track action performance

Performance Monitoring

Component Performance

Track component render times:

Custom Spans

Add custom performance tracking:

Composition API

Use Sentry in Vue 3 Composition API:

Error Handling

Global Error Handler

The SDK automatically integrates with Vue’s error handler:

Manual Error Capture

Context & Breadcrumbs

Component Context

Advanced Configuration

Tracing Mixins (Vue 2)

For Vue 2, use tracing mixins:

Best Practices

Initialize Early

Initialize Sentry before creating your Vue app to catch all errors.

Router Integration

Always pass your router instance for accurate navigation tracking.

Component Tracking

Enable component tracking to understand performance bottlenecks.

Pinia Plugin

Use the Pinia plugin to track store actions and state.

Examples

Next Steps

Vue Router

Advanced router integration patterns

Pinia

State management tracking

Performance

Component performance monitoring

Source Maps

Upload source maps for better stack traces