TanStack Router

Learn about Sentry's TanStack Router integration.

Image for: Learn about Sentry's TanStack Router integration.

The TanStack Router integration is included in the @sentry/react package and is compatible with version 1.64.0 of @tanstack/react-router and above.

The TanStack Router instrumentation uses your TanStack Router routes to create pageload/navigation transactions to ensure you collect meaningful performance data about the health of your page loads and associated requests.

Image for: Usage

To use the TanStack Router integration, pass the Sentry.tanstackRouterBrowserTracingIntegration inside your integrations option:

Copied
import * as Sentry from "@sentry/react";
import { createRouter } from "@tanstack/react-router";

const router = createRouter({
  // Your router options...
});

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  integrations: [Sentry.tanstackRouterBrowserTracingIntegration(router)],

  // Setting a sample rate is required for sending performance data.
  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control.
  tracesSampleRate: 1.0,
});

Image for: Next Steps:
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").