Custom Events
Track custom events to measure conversions, user engagement, and chatbot effectiveness.
What Are Custom Events?
Custom events let you track specific user actions and outcomes beyond standard metrics:
Purchase completed
E-commerce conversions
Demo scheduled
Lead qualification
Feature explored
Product discovery
Support resolved
Customer success
Document downloaded
Content engagement
Pricing viewed
Sales intent signals
JavaScript API
// Basic event
window.Chatmefy.track('button_clicked', {
button_name: 'Schedule Demo',
page: '/pricing'
});
// Conversion event with value
window.Chatmefy.track('purchase_completed', {
order_id: 'ORD-12345',
value: 299.00,
currency: 'USD',
items: ['Pro Plan']
});
// Lead qualification event
window.Chatmefy.track('demo_scheduled', {
meeting_date: '2024-01-20',
attendees: 3,
company_size: '50-100'
});Method Signature
Chatmefy.track(eventName: string, properties?: object): voideventNameRequired. Event identifier (snake_case recommended)propertiesOptional. Key-value pairs with event dataServer-Side Events
Track events from your backend for sensitive or server-triggered actions:
/v1/eventscurl -X POST "https://api.chatmefy.com/v1/events" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"event": "subscription_upgraded",
"conversation_id": "conv_abc123",
"visitor_id": "vis_xyz789",
"properties": {
"plan": "enterprise",
"mrr": 499,
"previous_plan": "pro"
},
"timestamp": "2024-01-15T14:30:00Z"
}'Built-in Events
These events are tracked automatically by Chatmefy:
| Event | Triggered When | Properties |
|---|---|---|
| widget_opened | User opens chat widget | page_url, timestamp |
| message_sent | User sends a message | message_length, response_time |
| lead_captured | Lead form submitted | email, fields_collected |
| conversation_ended | Chat session ends | duration, message_count |
| handoff_requested | User requests human agent | wait_time, reason |
| link_clicked | User clicks a bot-provided link | url, link_text |
Creating Event Funnels
Combine events to create conversion funnels and measure drop-off:
widget_opened100%pricing_viewed45%demo_scheduled12%purchase_completed8%Configure funnels in Dashboard → Analytics → Custom Funnels
Best Practices
Use consistent naming
Stick to snake_case: purchase_completed, not PurchaseCompleted
Include context
Add relevant properties like page, source, user_segment
Track meaningful events
Focus on business outcomes, not every click
Set monetary values
Include value and currency for revenue events
Use visitor IDs
Associate events with visitors for journey analysis