Prerequisites

Before setting up event tracking, make sure you have an analytics project in Userorbit and the Userorbit SDK installed in your application. If you have not done this yet, follow the "Getting started with analytics" guide first.

Configuring events via the SDK

Event tracking starts in your application code. The Userorbit SDK provides a track() method that sends event data to your project.

Basic usage:

userorbit.track('event_name', { property1: 'value1', property2: 'value2' });

The first argument is the event name (a string). The second argument is an optional object containing event properties — key-value pairs that add context to the event.

Event naming conventions

Consistent event names make your analytics data much easier to work with. Follow these guidelines:

  • Use snake_case — For example, page_viewed, button_clicked, form_submitted.
  • Use past tense verbs — Events represent something that happened, so item_purchased is better than purchase_item.
  • Be specific but not overly granular — Use signup_completed rather than just completed, but avoid embedding variable data in the name like signup_completed_homepage. Put variable data in properties instead.
  • Group related events with prefixes — For example, onboarding_started, onboarding_step_completed, onboarding_finished.

Event properties

Properties give events their analytical power. Without properties, you know that something happened; with properties, you know the full story.

Common property patterns:

  • Location context{ page: '/pricing', section: 'hero' }
  • Object details{ planName: 'pro', planPrice: 49, billingCycle: 'monthly' }
  • User action context{ searchQuery: 'analytics', resultsCount: 12 }

Property values can be strings, numbers, or booleans. Avoid nested objects — keep properties flat for the best query performance.

Identifying users

To tie events to specific user profiles, identify the user before tracking events:

userorbit.identify('user-123', { name: 'Jane Doe', email: 'jane@example.com', plan: 'pro' });

Call identify() once when the user logs in or when you know who they are. All subsequent track() calls will be associated with that user.

Testing your events

After adding tracking code, verify that events are arriving correctly:

  1. Open the Live Events view in your Userorbit project.
  2. Trigger the action in your application.
  3. Confirm the event appears in the live stream within a few seconds.
  4. Click on the event to verify that all properties are present and have the correct values.

If events are not appearing:

  • Check that the SDK is initialized with the correct API key.
  • Verify that identify() and track() calls are executing (add a console log before the call).
  • Inspect network requests in your browser's developer tools to confirm requests are being sent.
  • Look for error responses in the network tab that might indicate invalid data.

Best practices

  • Track events at the moment the action completes, not when the user initiates it.
  • Maintain a shared tracking plan document so your team stays aligned on event names and properties.
  • Avoid tracking every possible interaction — focus on events that inform product decisions.
  • Review your event list periodically and archive events that are no longer relevant.

Was this page helpful?