Skip to main content

Custom Events

Track application-specific actions using DAP('track', eventName, properties). Custom events are batched and sent to the server automatically, where they appear in your analytics dashboard and can be used for audience targeting.

Sending a Custom Event

Pass an event name and an optional properties object:

DAP("track", "feature_activated", {
featureName: "dark-mode",
plan: "pro",
});

The properties object accepts string, number, and boolean values:

DAP("track", "purchase_completed", {
orderId: "ORD-12345",
amount: 99.99,
isFirstPurchase: true,
itemCount: 3,
});

Common Use Cases

Feature usage -- Understand which features are adopted and how often.

DAP("track", "report_exported", { format: "csv", rowCount: 500 });

Button clicks -- Track interactions with key UI elements.

DAP("track", "cta_clicked", { location: "pricing_page", variant: "annual" });

Form submissions -- Capture when users complete important forms.

DAP("track", "form_submitted", {
formName: "contact_sales",
source: "homepage",
});

Onboarding milestones -- Record progress through onboarding steps.

DAP("track", "onboarding_step_completed", { step: 3, stepName: "invite_team" });

Naming Conventions

Use snake_case for event names and keep them consistent across your application:

// Recommended
DAP("track", "user_signed_up");
DAP("track", "user_logged_in");
DAP("track", "user_logged_out");

// Avoid inconsistent or vague names
// DAP('track', 'click');
// DAP('track', 'SignUp');
// DAP('track', 'user-login');

How Events Are Delivered

Custom events are queued in an internal batcher and flushed to the server periodically or when the batch reaches a size threshold. When the user navigates away, pending events are flushed immediately. No additional configuration is required.