Skip to main content
Records a custom event. Events are sent to the Hacktionbase API and can be used to build segments, trigger campaigns, and analyze user behavior.

Parameters

string
required
Event name. Use snake_case by convention (e.g., project_created, checkout_completed).
object
Optional key-value pairs attached to the event.

Example

Automatic events

The SDK tracks these events automatically — you don’t need to call track for them:

Delivery

Events are sent using navigator.sendBeacon for reliability (works even during page unload). If sendBeacon is unavailable, the SDK falls back to fetch with keepalive: true. Events are delivered asynchronously and never block the host page. Network failures are silently ignored — tracking must never break your application.

Context

Every event automatically includes:
  • sessionId — current session identifier
  • anonymousId — persistent anonymous identifier
  • userId — set after identify() is called
  • accountId — set if the identified user has an account
  • device — browser, OS, screen resolution, language, timezone
  • timestamp — millisecond Unix timestamp