Tracking Custom Events
Datsnip automatically tracks page views and experiment exposures. For anything else — purchases, signups, button clicks, feature activations — you add a tracking call where that action happens.
The tracking call
window.datsnip.track('your_event_name', { optional: 'data' })
Call this when something meaningful happens. That's all there is to it.
Examples
E-commerce purchase:
window.datsnip.track('purchase', { revenue: 79.99 })
Newsletter signup:
window.datsnip.track('newsletter_signup')
Trial started:
window.datsnip.track('trial_started', { plan: 'pro' })
Form submitted:
window.datsnip.track('contact_form_submitted')
Feature used:
window.datsnip.track('export_used')
Using events as experiment goals
When creating an experiment goal, choose Custom event and enter the event name. When any visitor fires that event, it counts as a conversion for their assigned variant.
This is how you measure whether an experiment drove more signups, purchases, or any other action — not just page visits and clicks.
Revenue tracking
If your event includes a revenue property (a number), Datsnip automatically tracks revenue per visitor for each experiment variant:
window.datsnip.track('purchase', { revenue: 49.99 })
No extra setup. Your experiment results will show revenue per visitor alongside conversion rate.
Using events in funnel analysis
Events you track appear as step options in Funnel Analysis. This lets you build funnels that combine page views and custom actions:
/product page → add_to_cart → /checkout → purchase
What events to track
Track these on every site:
- Primary conversion action (purchase, signup, form submission)
- Secondary conversion (newsletter signup, demo request, free trial start)
E-commerce additions:
add_to_cart,remove_from_cart,checkout_started
SaaS additions:
trial_started,onboarding_completed,first_key_action,upgrade_clicked
Content site additions:
email_signup,article_shared,download_completed
Keep event names lowercase with underscores. Be consistent — purchase and Purchase are treated as different events.