@lssm/lib.personalization

Track field/feature/workflow usage, analyze drop-offs, and convert insights into OverlaySpecs or workflow tweaks.

Tracker

Buffer events per tenant/user and emit OpenTelemetry counters automatically.

import { createBehaviorTracker } from '@lssm/lib.personalization';

const tracker = createBehaviorTracker({
  store,
  context: { tenantId: ctx.tenant.id, userId: ctx.identity.id },
});

tracker.trackFieldAccess({ operation: 'billing.createOrder', field: 'items' });
tracker.trackWorkflowStep({ workflow: 'invoice', step: 'review', status: 'entered' });

Analyzer

Summarize events and highlight unused UI, frequent fields, and workflow bottlenecks.

import { BehaviorAnalyzer } from '@lssm/lib.personalization/analyzer';

const analyzer = new BehaviorAnalyzer(store);
const insights = await analyzer.analyze({ tenantId: 'acme', userId: 'ops-42' });
// { unusedFields: ['internalNotes'], workflowBottlenecks: [...] }

Adapter

Convert insights into overlays or workflow extension hints.

import { insightsToOverlaySuggestion } from '@lssm/lib.personalization/adapter';

const overlay = insightsToOverlaySuggestion(insights, {
  overlayId: 'acme-order-form',
  tenantId: 'acme',
  capability: 'billing.createOrder',
});