Browse docs

Jump to core topics without leaving the page.

React SDK

Add FlashAnalytics to React applications with a lightweight client setup.

The React SDK makes it easy to track page views and user actions in single-page applications.

Best for

  • React SPAs using React Router
  • Teams that want client-side analytics
  • Products with custom UI event tracking

Install

Install the SDK and initialize it once in your app entrypoint.

Install FlashAnalytics

Initialize

import { fa } from '@flash-analytics/sdk';

fa.init({
  appId: 'YOUR_CLIENT_ID',
  capturePageViews: true,
});

Track events

fa.track('feature_used', {
  feature: 'export_csv',
});

Routing

If you manage routing manually, trigger a page view event when the route changes to keep session analysis accurate.