Harshit Metrics
Concepts

Events

Understanding the event model in Harshit Metrics.

What is an event?

An event is a single recorded interaction or occurrence. Every piece of data in Harshit Metrics is an event.

Event structure

{
  "name": "pageview",
  "path": "/pricing",
  "url": "https://example.com/pricing",
  "referrer": "https://google.com",
  "metadata": {
    "viewportWidth": 1920,
    "browser": "Chrome",
    "plan": "pro"
  },
  "sessionId": "s_abc123",
  "visitorId": "v_xyz890",
  "occurredAt": "2026-05-23T10:30:00.000Z"
}

Event types

System events (auto-tracked)

NameDescriptionTracked by
pageviewPage loaded or SPA navigationautoTrackPageviews, autoTrackRouteChanges
scroll_depthUser scrolled past a thresholdautoTrackScrollDepth
errorUnhandled JavaScript errorautoTrackErrors
unhandled_rejectionUnhandled promise rejectionautoTrackErrors
web_vitalPerformance metric (LCP, FID, etc.)autoTrackWebVitals
outbound_clickClick on external linkautoTrackOutbound
form_submitForm submissionautoTrackForms
session_endSession ended (with duration)Automatic on page hide/timeout

Identity events

NameDescription
identifyUser identified via identify()
groupGroup associated via group()

Business events (your custom events)

NameDescription
revenueRevenue tracked via trackRevenue()
feature_flagFeature flag tracked via trackFeatureFlag()
Any custom nameTracked via track("your_event_name")

Naming conventions

  • Use snake_case for event names
  • Be specific: signup_form_submitted > form_submitted
  • Use a verb: button_clicked, plan_upgraded, file_exported
  • Keep cardinality bounded — don't use unique IDs in event names

Metadata

Metadata is a flat or nested key-value object attached to each event. It's where you store the "what" and "why" behind an event.

Best practices:

  • Keep keys consistent across events
  • Use primitive values (strings, numbers, booleans) when possible
  • Don't store PII (emails, passwords, phone numbers)

On this page