JavaScript SDK
Use the JavaScript SDK or script tag to track events on any website.
The JavaScript SDK works in modern browsers and supports TypeScript for safer integrations. For the fastest setup, use the script tag.
Best for
- Marketing sites and landing pages
- Web apps that need custom event tracking
- Teams that want a lightweight client SDK
Install
Use the install guide for script tag or SDK setup.
Initialize
import { fa } from '@flash-analytics/sdk';
fa.init({
appId: 'YOUR_CLIENT_ID',
});Track events
fa.track('pricing_viewed', {
plan: 'pro',
source: 'navbar',
});Tips
- Use consistent event names across the product
- Attach meaningful properties for segmentation
- Verify events in the real-time dashboard
