ClarmTrack API

Once the widget loader has initialized, Clarm exposes a browser helper at window.ClarmTrack. Use window.ClarmTrack.track(event, properties) for custom tracking.

Signature

Type definitiontypescript
type ClarmTrack = {
  track: (
    event: 'identify' | 'purchase' | 'click' | 'goal_achieved' | string,
    properties?: Record<string, unknown>
  ) => void
}

identify

Attach known user identity to the current visitor after sign-in, lead capture, or checkout.

identifyjavascript
window.ClarmTrack?.track('identify', {
  email: '[email protected]',    // required
  name: 'Jane Smith',        // optional
  company: 'Acme Inc',       // optional
  plan: 'enterprise',        // optional
  // any custom properties
  role: 'VP Engineering',
  team_size: 50
});

purchase

Track a conversion or purchase event for revenue attribution.

purchasejavascript
window.ClarmTrack?.track('purchase', {
  amount: 299.00,        // required — numeric value
  currency: 'USD',       // optional, default: 'USD'
  plan: 'growth',        // optional
  orderId: 'ord_abc123', // optional — for deduplication
});

click

Track CTA or element clicks for funnel analysis.

clickjavascript
window.ClarmTrack?.track('click', {
  element: 'pricing_cta',
  page: '/pricing'
});

goal_achieved

Track when a visitor completes a goal, e.g., books a demo.

goal_achievedjavascript
window.ClarmTrack?.track('goal_achieved', {
  goal: 'demo_booked',
  value: 500
});

Custom events

You can send any custom event name:

Custom eventjavascript
window.ClarmTrack?.track('video_watched', {
  videoId: 'intro-demo',
  watchTime: 45
});

Implementation note

Keep your instrumentation focused on business-relevant events. Most customers only addidentify, purchase, and one or two custom milestones on top of the automatic widget tracking.