Custom Events
Track actions that matter to your business: button clicks, form submissions, sign-ups, purchases, or any custom event.
Basic Usage
Use WysLeap.trackEvent(name, data) to track custom events with optional metadata:
WysLeap.trackEvent('event_name', {
key1: 'value1',
key2: 'value2'
});Common Examples
Button or CTA Click
document.querySelector('#signup-btn').addEventListener('click', function() {
WysLeap.trackEvent('cta_click', {
buttonId: 'signup',
location: 'header',
text: 'Get started'
});
});Form Submission
document.querySelector('#contact-form').addEventListener('submit', function(e) {
WysLeap.trackEvent('form_submit', {
formId: 'contact',
formName: 'Contact us'
});
});Purchase or Conversion
// On checkout success or thank-you page
WysLeap.trackEvent('purchase_completed', {
productId: 'prod_123',
productName: 'Premium Plan',
price: 99.99,
currency: 'USD',
category: 'subscription'
});Sign-up / Lead
WysLeap.trackEvent('signup_completed', {
method: 'email',
plan: 'free'
});Best Practices
- Use descriptive names:
purchase_completednotevent1 - Include context: Add metadata like location, value, category
- Be consistent: Use the same event names across your app
- Don't track PII: Avoid tracking sensitive user information
Viewing Your Events
Events appear in your analytics dashboard and can be used for funnels, intent scoring, and journey analysis.
Ready for SaaS-Specific Tracking?
If you're building a SaaS product, learn how to track PLG metrics like activation, trials, PQLs, and churn risk.
Next: SaaS / PLG Tracking