@lssm/lib.analytics

Work directly with telemetry events to understand conversion, retention, churn, and growth opportunities.

Funnels in memory

import { FunnelAnalyzer } from '@lssm/lib.analytics/funnel';

const analyzer = new FunnelAnalyzer();
const report = analyzer.analyze(events, {
  name: 'signup',
  steps: [
    { id: 'view', eventName: 'page.view', match: (e) => e.properties?.slug === '/signup' },
    { id: 'submit', eventName: 'signup.submit' },
    { id: 'verified', eventName: 'account.verified' },
  ],
});

Cohorts & churn

import { CohortTracker } from '@lssm/lib.analytics/cohort';
import { ChurnPredictor } from '@lssm/lib.analytics/churn';

const cohorts = new CohortTracker().analyze(events, { bucket: 'week', periods: 8 });
const churn = new ChurnPredictor().score(events);

Growth hypotheses

import { GrowthHypothesisGenerator } from '@lssm/lib.analytics/growth';

const ideas = new GrowthHypothesisGenerator().generate([
  { name: 'Activation rate', current: 0.42, previous: 0.55, target: 0.6 },
  { name: 'Expansion ARPU', current: 1.2, previous: 0.9 },
]);