Docs/Custom Events

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

Track Event
// 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): void
eventNameRequired. Event identifier (snake_case recommended)
propertiesOptional. Key-value pairs with event data

Server-Side Events

Track events from your backend for sensitive or server-triggered actions:

POST/v1/events
curl -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:

EventTriggered WhenProperties
widget_openedUser opens chat widgetpage_url, timestamp
message_sentUser sends a messagemessage_length, response_time
lead_capturedLead form submittedemail, fields_collected
conversation_endedChat session endsduration, message_count
handoff_requestedUser requests human agentwait_time, reason
link_clickedUser clicks a bot-provided linkurl, link_text

Creating Event Funnels

Combine events to create conversion funnels and measure drop-off:

1widget_opened100%
2pricing_viewed45%
3demo_scheduled12%
4purchase_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

Analyze Your Events