Not all user actions are created equal. Learn how to track the events that actually impact your business.
Why Custom Event Tracking?
Automatic click tracking captures everything, but custom events let you focus on what matters:
- Signup button clicks
- Pricing page visits
- Feature usage
- Checkout completions
Setting Up Custom Events
Using data-peeke Attributes
The simplest way to track specific elements:
<button data-peeke="signup-button">Sign Up</button>
<form data-peeke="checkout-form">...</form>
Every click on these elements creates a named event you can filter and analyze.
Programmatic Tracking
For more complex scenarios, use the JavaScript API:
// Track a custom event
peeke.trackEvent('plan_selected', {
plan: 'pro',
price: 29
});
// Track after user identifies themselves
peeke.identify('user@example.com', 'John Doe');
Best Practices
1. Name Events Consistently
Use snake_case and be descriptive:
- ✅
checkout_started - ✅
plan_upgraded - ❌
click1 - ❌
btn
2. Add Relevant Properties
Include context that helps analysis:
peeke.trackEvent('item_added_to_cart', {
product_id: '123',
product_name: 'Pro Plan',
value: 29
});
3. Don't Over-Track
Focus on conversion-critical events. Too many events create noise.
Analyzing Events
Once events are flowing, you can:
- Filter session recordings by event
- See event timelines per user
- Build conversion funnels
Conclusion
Custom event tracking transforms generic analytics into actionable insights. Start with 5-10 key events and expand from there.