Single Event API (Recommended)
The/v1/event
endpoint is the primary way to track user events - simple, fast, and perfect for most applications:
Minimal Example (Required Fields Only)
- cURL
- Node.js
- Python
π Standard Example (With Event Data)
- cURL
- Node.js
- Python
π Field Requirements
Field | Required | Type | Description |
---|---|---|---|
β
event | REQUIRED | string | Event name (e.g., βuser_signed_upβ) |
β
user | REQUIRED | object | User object with id and optional traits |
β timestamp | Optional | string | ISO 8601 timestamp (defaults to now) |
β properties | Optional | object | Event-specific data |
π¦ Batch Events API (Advanced)
For high-volume applications only - use/v1/events
to send multiple events:
- Event Tracking
- User Identification
Track user actions - Creates event records with minimal payload size
- cURL
- Node.js
- Python
Use
/v1/event
for most applications - the batch endpoint is only needed
for high-volume scenarios (100+ events per minute)Browser SDK (Optional)
For frontend-only applications, you can use the JavaScript SDK:- Event Tracking
- User Identification
Event Format & User Data
Flexible User Format
UserBoost supports two user formats - use the one that fits your needs:- Simple User ID (Minimal)
- User Object (Rich Data)
Most common approach - Send just the user ID as a stringWhen to use:
- Youβre tracking events for existing users
- User data is already stored in your system
- You want minimal payload size
Properties vs Traits
Key Distinction: - Properties: Event-specific data (what happened
during this event) - Traits: User-specific attributes (persistent info
about who the user is)
- Properties (Event Data)
- Traits (User Data)
- Event context (what button was clicked)
- Transaction details (amount, product)
- Session information (page viewed)
- Temporary state (current cart size)
Single Event API (Recommended)
For most use cases, use the/v1/event
endpoint:
- Basic Event
- Batch Events API (Optional)
- Simple payload structure
- Real-time event processing
- Automatic context extraction (IP, User-Agent)
- Optional timestamp (auto-generated if not provided)
Required Fields
Every event must include a
user
field and event
field. The user field
must be an object with at least an id
property.- Direct API (Optimized)
- Browser SDK
Full Example
- Browser Script Tag
- NPM Package
Event Naming
Best Practices
β
Good Event Names
β Good Event Names
user_signed_up
- Clear action -profile_completed
- Specific milestonefirst_project_created
- Meaningful achievement -payment_method_added
- Precise user action -
tutorial_finished
- Clear completion state
β Avoid These Names
β Avoid These Names
click
- Too generic -user_action_performed
- Vague -page_view_homepage
- Usually not meaningful -button_1_clicked
- Use descriptive names -internal_system_update
- Not user-facing
Naming Convention
Use snake_case with descriptive, action-oriented names:- Browser Script Tag
- NPM Package
Common Event Patterns
User Lifecycle Events
Track key moments in the user journey:- Registration
- Onboarding
- Engagement
- Conversion
- Browser Script Tag
- NPM Package
Feature Adoption
Track how users discover and adopt your features:- Browser Script Tag
- NPM Package
Team and Collaboration
For B2B SaaS, track team dynamics:- Browser Script Tag
- NPM Package
Event Properties
Property Guidelines
- Recommended Properties
- Avoid These
- Browser Script Tag
- NPM Package
Property Types & Examples
Type | Format | Use Cases | Example |
---|---|---|---|
String | "value" | Categories, IDs | plan: "pro" |
Number | 42 , 99.99 | Counts, prices | amount: 99.99 |
Boolean | true /false | Flags | is_trial: true |
Date | "YYYY-MM-DD" | Time tracking | trial_end: "2025-02-15" |
Batching and Performance
Automatic Batching
UserBoost automatically batches events for optimal performance:- Browser Script Tag
- NPM Package
Manual Flushing
Force immediate sending when needed:- Browser Script Tag
- NPM Package
Performance Tips
Optimize Event Volume
Optimize Event Volume
- Browser Script Tag
- NPM Package
Minimize Property Size
Minimize Property Size
- Browser Script Tag
- NPM Package
Error Handling
Client-Side Errors
UserBoost handles network errors gracefully:- Browser Script Tag
- NPM Package
Validation Errors
Common validation issues:Missing User ID
- Browser Script Tag
- NPM Package
Testing Events
Debug Mode
Enable debugging to see event details:- Browser Script Tag
- NPM Package
Dashboard Testing
1
Enable Debug
Turn on debug mode in your code
2
Trigger Events
Perform actions in your app to generate events
3
Check Console
Verify events are logged without errors
4
View Dashboard
Go to Events β Live Stream to see events arrive