Skip to main content
Hacktionbase.track(event, properties?)
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

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

Example

Hacktionbase.track('project_created', {
  projectName: 'My Project',
  plan: 'growth',
  teamSize: 5
});

Automatic events

The SDK tracks these events automatically — you don’t need to call track for them:
EventDescription
page_viewFired on every page navigation (including SPA route changes)
js_errorFired on unhandled errors and console.error calls
replay_triggeredFired when session replay transitions from buffer to recording

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