Skip to main content

Overview

Events represent actions your users take in your application. They are the foundation for building segments, triggering campaigns, and understanding user behavior.

Sending events

You can send events from two places:
SourceHowBest for
SDK (client-side)Hacktionbase.track('event', props)Page views, clicks, UI interactions
API (server-side)POST /v1/eventsPurchases, subscription changes, backend actions

From the SDK

Hacktionbase.track('checkout_completed', {
  total: 99.99,
  currency: 'EUR',
  items: 3
});

From your backend

curl -X POST https://api.hacktionbase.com/v1/events \
  -H "Authorization: Bearer hb_key_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "event": "subscription_upgraded",
    "userExternalId": "user_123",
    "properties": { "plan": "growth" }
  }'

Automatic events

The SDK tracks these events automatically — no code needed:
EventTrigger
page_viewEvery page navigation (initial load + SPA route changes)
js_errorUnhandled JavaScript errors

Naming conventions

Use snake_case for event names:
// ✅ Recommended
Hacktionbase.track('feature_activated', { feature: 'dark_mode' });

// ❌ Avoid
Hacktionbase.track('Feature Activated');   // Spaces
Hacktionbase.track('featureActivated');    // camelCase

How events power the platform

Once events are tracked, they feed into several features:
  • Segments — define user groups based on event history (e.g., “users who completed checkout in the last 7 days”)
  • Campaigns — trigger in-app messages or emails when specific events occur
  • User timeline — view a chronological feed of events on each user’s profile
  • Session context — events are linked to sessions, so you can see exactly what happened during a replay