flusterduck-vite-plugin
v0.5.2
Published
Placeholder for flusterduck-vite-plugin
Readme
flusterduck-vite-plugin
Vite plugin for Flusterduck. Injects the Flusterduck script tag automatically during the build so you don't have to add it manually to your HTML template.
Installation
npm install --save-dev flusterduck-vite-pluginUsage
// vite.config.ts
import { defineConfig } from 'vite';
import flusterduck from 'flusterduck-vite-plugin';
export default defineConfig({
plugins: [
flusterduck({
apiKey: 'fd_pub_...',
environment: 'production',
}),
],
});This injects a <script> tag pointing to https://cdn.jsdelivr.net/npm/flusterduck@0/dist/d.global.js with your data-key attribute into the built HTML output.
Options
| Option | Type | Description |
|---|---|---|
| apiKey | string | Publishable key (fd_pub_...). Required. |
| environment | string | Tag events by environment |
| debug | boolean | Enable SDK debug output |
| cookieless | boolean | Use memory-only session IDs instead of cookies |
| sampleRate | number | Fraction of sessions to track (0-1) |
| enabled | boolean | Set to false to disable injection entirely |
Environment-based injection
flusterduck({
apiKey: process.env.VITE_FLUSTERDUCK_KEY,
enabled: process.env.NODE_ENV === 'production',
})