Events

Track custom events, clicks, scrolls, and user interactions.

Custom Events#

Beyond automatic pageview tracking, you can send custom events to track specific user interactions like button clicks, form submissions, and feature usage.

Sending Custom Events#

Use the global justanalytics object to send custom events:

// Track a button click
justanalytics.track('signup_click', {
  plan: 'pro',
  source: 'header_cta'
});

// Track a form submission
justanalytics.track('form_submit', {
  form: 'contact',
  fields_filled: 5
});

// Track a feature usage
justanalytics.track('feature_used', {
  feature: 'dark_mode',
  action: 'enabled'
});

Event Properties#

Each custom event can include up to 20 custom properties. Properties are key-value pairs where:

  • Keys are strings (max 100 characters)
  • Values can be strings, numbers, or booleans
justanalytics.track('purchase', {
  product_id: 'sku_12345',
  product_name: 'Pro Plan',
  price: 49.00,
  currency: 'USD',
  is_upgrade: true
});

Event Naming Conventions#

We recommend using snake_case for event names and properties:

| Good | Avoid | |------|-------| | signup_click | Signup Click | | purchase_complete | purchaseComplete | | page_scroll_50 | Page Scroll 50% |

Viewing Events#

Custom events appear in your dashboard under Analytics > Events. You can:

  • View event counts over time
  • Break down events by property values
  • Filter by specific event names
  • Export event data as CSV

Built-in Events#

The tracker automatically captures these events:

| Event | Trigger | Properties | |-------|---------|------------| | pageview | Page load or SPA navigation | url, referrer, title | | session_start | New session begins | entry_page, referrer | | session_end | Session expires | duration, page_count |

Rate Limits#

Custom events are subject to rate limiting:

  • 100 events per page per session
  • 10,000 events per site per minute
  • Events exceeding limits are silently dropped

If you consistently hit limits, consider batching or sampling events.