Event Tracking
Events are the foundation of understanding user behavior. Track meaningful actions users take in your product to build funnels, analyze engagement, and optimize your growth strategy.
What are Events?
Events represent specific actions users take in your application. Every button click, form submission, page view, or feature usage can be tracked as an event to help you understand how users interact with your product.
ROAARRR automatically tracks page views when you initialize the SDK. For everything else, use the funnel() method.
Tracking Events
Basic Event Tracking
Track a simple event with just a name:
// Track a button click
analytics.funnel('signup_button_clicked');
// Track a feature usage
analytics.funnel('export_data_clicked');
// Track a milestone
analytics.funnel('profile_completed');Events with Properties
Add context to events with custom properties:
// Track button click with context
analytics.funnel('button_clicked', {
button_name: 'signup',
button_location: 'hero_section',
page: 'homepage'
});
// Track feature usage with details
analytics.funnel('report_generated', {
report_type: 'monthly_revenue',
format: 'pdf',
date_range: '30_days'
});
// Track form submission
analytics.funnel('contact_form_submitted', {
form_id: 'contact_sales',
company_size: '50-100',
interest: 'enterprise_plan'
});Event Naming Conventions
Use consistent naming patterns to keep your analytics organized:
Object-Action Pattern
Format: object_action
analytics.funnel('project_created');
analytics.funnel('dashboard_viewed');
analytics.funnel('report_exported');
analytics.funnel('team_member_invited');Past Tense for Completed Actions
Use past tense to indicate the action has been completed:
// Good
analytics.funnel('signup_completed');
analytics.funnel('payment_processed');
// Avoid
analytics.funnel('signup_complete');
analytics.funnel('process_payment');Lowercase with Underscores
Keep names lowercase and use underscores for readability:
// Good
analytics.funnel('user_settings_updated');
// Avoid
analytics.funnel('UserSettingsUpdated');
analytics.funnel('user-settings-updated');Common Event Types
User Actions
// Navigation
// Clicks
analytics.funnel('cta_clicked', {
cta_text: 'Start Free Trial',
location: 'pricing_page'
});
// Form interactions
analytics.funnel('form_started', {
form_name: 'signup'
});
analytics.funnel('form_submitted', {
form_name: 'signup',
fields_completed: 5
});Feature Usage
// Feature access
analytics.funnel('feature_accessed', {
feature_name: 'advanced_analytics',
user_plan: 'pro'
});
// Tool usage
analytics.funnel('tool_used', {
tool_name: 'data_export',
export_format: 'csv'
});
// Settings changes
analytics.funnel('settings_updated', {
setting_type: 'notifications',
enabled: true
});E-commerce Events
// Product interactions
analytics.funnel('product_viewed', {
product_id: 'pro_123',
product_name: 'Pro Plan',
price: 99.00
});
analytics.funnel('add_to_cart', {
product_id: 'pro_123',
quantity: 1
});
// Checkout flow
analytics.funnel('checkout_started', {
cart_value: 99.00,
items_count: 1
});
analytics.funnel('purchase_completed', {
order_id: 'ord_456',
amount: 99.00,
currency: 'usd',
plan: 'pro_monthly'
});Social Events
// Content creation
analytics.funnel('content_created', {
content_type: 'blog_post',
word_count: 1234
});
// Sharing
analytics.funnel('content_shared', {
platform: 'twitter',
content_id: 'post_789'
});
// Engagement
analytics.funnel('comment_posted', {
post_id: 'post_123',
comment_length: 45
});Event Properties Best Practices
1. Use Consistent Property Names
Maintain consistent naming across different events:
// Good - consistent property names
analytics.funnel('project_created', { user_id: '123' });
analytics.funnel('project_updated', { user_id: '123' });
// Avoid - inconsistent naming
analytics.funnel('project_created', { user_id: '123' });
analytics.funnel('project_updated', { userId: '123' });2. Include Relevant Context
Add properties that help you segment and analyze behavior:
analytics.funnel('feature_used', {
feature_name: 'export',
user_plan: 'pro',
user_role: 'admin',
team_size: 15,
days_since_signup: 7
});3. Keep Property Values Simple
Use strings, numbers, and booleans. Avoid complex objects:
// Good
analytics.funnel('filter_applied', {
filter_type: 'date_range',
start_date: '2024-01-01',
end_date: '2024-01-31'
});
// Avoid
analytics.funnel('filter_applied', {
filter: { type: 'date', range: { start: '...', end: '...' } }
});4. Don't Track Sensitive Data
Never include passwords, credit card numbers, or other sensitive information in event properties.
Building Funnels
Track sequential events to understand conversion flows:
// Signup funnel
analytics.funnel('signup_viewed');
analytics.funnel('signup_started');
analytics.funnel('signup_completed');
// Onboarding funnel
analytics.funnel('onboarding_started');
analytics.funnel('profile_completed');
analytics.funnel('first_project_created');
analytics.funnel('team_invited');
analytics.funnel('onboarding_completed');
// Purchase funnel
analytics.funnel('pricing_viewed');
analytics.funnel('plan_selected', { plan: 'pro' });
analytics.funnel('checkout_started');
analytics.funnel('payment_info_entered');
analytics.funnel('purchase_completed');Tracking Event Timing
Measure how long actions take to optimize user experience:
// Track duration of an action
const startTime = Date.now();
// ... user performs action ...
analytics.funnel('report_generated', {
generation_time_ms: Date.now() - startTime,
report_type: 'monthly'
});
// Track time between events
const signupTime = Date.now();
localStorage.setItem('signup_time', signupTime);
// Later...
const timeToFirstAction = Date.now() -
parseInt(localStorage.getItem('signup_time'));
analytics.funnel('first_project_created', {
time_to_first_action_ms: timeToFirstAction
});Pro Tip
Start with tracking the core events that matter most to your business metrics, then expand. Too many events can make analysis overwhelming.
Focus on events that help answer questions like: Where do users drop off? Which features drive retention? What actions predict conversion?
Next Steps
- Learn about user identification to track events by user
- Explore activation tracking to measure key milestones
- Check the full API reference for advanced options