Skip to main content
Breadcrumbs are a trail of events that happened prior to an issue. They help you understand the context and sequence of actions that led to an error.

What are Breadcrumbs?

Breadcrumbs are automatically captured by Sentry for common actions like:
  • Console logs
  • Network requests (fetch, XHR)
  • UI clicks and interactions
  • Navigation events
  • DOM mutations
You can also manually add breadcrumbs to track custom events.

Adding Breadcrumbs

Basic Usage

With Additional Data

Breadcrumbs support different severity levels:
By default, Sentry keeps the last 100 breadcrumbs. This limit can be configured using the maxBreadcrumbs option.
Organize breadcrumbs using categories:

User Actions

HTTP Requests

Console Logs

State Changes

Breadcrumbs can have specific types that affect how they’re displayed:

Configuration

Maximum Breadcrumbs

Control how many breadcrumbs are kept:

Filtering Breadcrumbs

Filter breadcrumbs before they’re added:
Returning null from beforeBreadcrumb will prevent the breadcrumb from being added.

Practical Examples

E-commerce Flow

API Integration

Form Validation

Working with Breadcrumbs in Scopes

Access Breadcrumbs

Get Last Breadcrumb

Clear Breadcrumbs

Clear breadcrumbs when starting a new logical operation or flow to keep the trail focused and relevant.

Automatic Breadcrumbs

Sentry automatically captures breadcrumbs for:

Console Logs

HTTP Requests

Automatically captured by the default integrations.

UI Events

Automatically captured for clicks and other interactions.

Best Practices

  1. Be descriptive: Use clear, descriptive messages that explain what happened
  2. Use categories: Organize breadcrumbs with consistent category names
  3. Add relevant data: Include data that helps understand the context
  4. Avoid sensitive data: Don’t log passwords, tokens, or PII
  5. Keep them focused: Only add breadcrumbs for significant events
  6. Use appropriate levels: Match the breadcrumb level to the event severity
Breadcrumbs are automatically included with error events, providing a timeline of what led to the error.

Next Steps

Scopes

Learn about managing scope data

Context

Add structured context to events

Error Monitoring

Capture errors with breadcrumb trails

Performance

Track performance with breadcrumbs