Custom Events

Track custom events to measure signups, button clicks, feature usage, and more.

Custom Events

Beyond pageviews, EngageTrack can track any custom event you define — signups, button clicks, feature usage, or any action meaningful to your business.

Sending Custom Events

JavaScript SDK

// Simple event
window.engagetrack("newsletter-subscribe");
 
// Event with properties
window.engagetrack("feature-used", {
	feature: "dark-mode",
	source: "settings",
});
 
// Alternative .track() alias
window.engagetrack.track("feature-used", { feature: "dark-mode" });

TypeScript / Next.js users: add an engagetrack.d.ts declaration file to your project so TypeScript recognises window.engagetrack. See the Goal Tracking page for the full snippet. Wrap any call in useEffect or guard with typeof window !== "undefined" to avoid SSR errors.

HTML Data Attributes

<button data-goal="cta-click" data-goal-location="hero">Get Started</button>

Custom events must be enabled in your site settings. Go to Site Settings → Tracking and toggle Custom events.

Automatic Event Types

EngageTrack also automatically tracks these event types (if enabled in Site Settings → Tracking):

Event TypeDescription
PageviewPage load (always tracked)
Form SubmissionForm submissions
File DownloadFile download clicks
Outbound LinkClicks on links to external domains
Phone ClickClicks on tel: links
Email ClickClicks on mailto: links
Scroll DepthContinuous scroll percentage (0-100%) sent with page events
PurchasePurchase detection via payment provider webhooks

Event Discovery

EngageTrack automatically discovers all custom events sent to your site. When the SDK sends a custom event for the first time, a goal is auto-created and appears in the Goals tab on your dashboard.

Event Properties

Custom events can include properties as key-value pairs. All values are stored as strings (max 255 characters), and keys must follow the same naming rules as event names (a-z, 0-9, _, -, max 64 chars):

  • "plan": "pro"
  • "price": "49" (numbers as strings)
  • "trial": "true" (booleans as strings)

Up to 10 properties per event are recorded; additional keys are silently discarded.

Goal Integration

Custom events are the foundation of the Goal Tracking system. Goals are auto-created from custom events and support:

  • Match by event name
  • Filter by property values using exact match, contains, or regex operators