humanbehavior-js
Version:
SDK for HumanBehavior session and event recording
29 lines (25 loc) • 998 B
text/typescript
import { HumanBehaviorTracker } from '../index.js';
import type { App } from 'vue';
interface HumanBehaviorPluginOptions {
apiKey: string;
ingestionUrl?: string;
logLevel?: 'none' | 'error' | 'warn' | 'info' | 'debug';
redactFields?: string[];
suppressConsoleErrors?: boolean;
recordCanvas?: boolean; // Enable canvas recording with PostHog-style protection
}
export const HumanBehaviorPlugin = {
install: (app: App, options: HumanBehaviorPluginOptions) => {
const tracker = HumanBehaviorTracker.init(options.apiKey, {
ingestionUrl: options.ingestionUrl,
logLevel: options.logLevel,
redactFields: options.redactFields,
suppressConsoleErrors: options.suppressConsoleErrors,
recordCanvas: options.recordCanvas, // Pass canvas recording option
});
// Make tracker available globally
app.config.globalProperties.$humanBehavior = tracker;
// Also provide it via inject/provide
app.provide('humanBehavior', tracker);
}
};