Features
Event Tracking
Track custom events to measure user interactions beyond page views.
Related Documentation
Looking for framework integration examples? Check out our JavaScript SDK guide for React, Vue, and Next.js examples, or our Platform Integrations for WordPress, Shopify, and more.
What are Events?
Events allow you to track specific user interactions on your website that aren't captured by default pageview tracking. Common use cases include:
- Button clicks (CTA buttons, download links)
- Form submissions
- Video plays
- File downloads
- External link clicks
- Newsletter signups
Tracking Events
Use the window.invoker.trackEvent() function to track events. Make sure the tracking script is loaded before calling this function.
Basic Event
Track a simple user interaction
// Track a simple event
window.invoker.trackEvent('button_click')Event with Properties
Add custom properties for deeper insights
// Track an event with custom properties
window.invoker.trackEvent('signup', {
plan: 'Pro',
source: 'pricing_page',
value: 99
})Examples
Event Properties
Properties allow you to add additional context to your events. Some guidelines:
- Property values should be strings or numbers
- Keep property names short and descriptive
- Use consistent naming conventions across events
- Avoid storing personally identifiable information (PII)
Viewing Event Data
Event data is available in the Events section of your dashboard:
- Navigate to your site dashboard
- Click "Events" in the sidebar
- View event counts and trends
- Click on an event to see property breakdowns
React Integration
// Create a tracking hook
function useTrackEvent() {
const trackEvent = (name: string, props?: Record<string, string | number>) => {
if (typeof window !== 'undefined' && window.invoker) {
window.invoker.trackEvent(name, props)
}
}
return trackEvent
}
// Use in components
function SignupButton() {
const trackEvent = useTrackEvent()
const handleClick = () => {
trackEvent('signup_click', { location: 'header' })
// ... handle signup
}
return <button onClick={handleClick}>Sign Up</button>
}Best Practices
- Name events clearly: Use action-oriented names like "Button Click" or "Form Submit"
- Be consistent: Use the same event names for similar actions across your site
- Don't over-track: Focus on meaningful interactions, not every click
- Use properties wisely: Add context that helps you analyze the data
- Test your events: Check the dashboard to verify events are being tracked correctly