flusterduck-webpack-plugin
v0.5.2
Published
Placeholder for flusterduck-webpack-plugin
Downloads
612
Readme
flusterduck-webpack-plugin
Webpack plugin for Flusterduck. Injects the Flusterduck script tag automatically into your HTML output during the build via html-webpack-plugin.
Installation
npm install --save-dev flusterduck-webpack-pluginUsage
// webpack.config.js
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FlusterduckPlugin = require('flusterduck-webpack-plugin');
module.exports = {
plugins: [
new HtmlWebpackPlugin({ template: './src/index.html' }),
new FlusterduckPlugin({
apiKey: 'fd_pub_...',
environment: 'production',
}),
],
};This appends a <script> tag pointing to https://cdn.jsdelivr.net/npm/flusterduck@0/dist/d.global.js with your data-key attribute to the <head> of the built HTML.
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
new FlusterduckPlugin({
apiKey: process.env.FLUSTERDUCK_KEY,
enabled: process.env.NODE_ENV === 'production',
})