Engagement score isn't a single metric—it's a composite of how frequently users interact with your product, how long they stay, and how valuable they are. Mixpanel doesn't calculate it for you, but you can build and monitor it by combining event tracking, user properties, and segmentation queries. Here's how.
Track Engagement Events with the SDK
Start by instrumenting your app to capture the actions that define engagement.
Initialize Mixpanel and track engagement events
Set up the Mixpanel JavaScript SDK and start tracking actions that indicate user engagement. Events like feature usage, API calls, and report generation are the raw material for your engagement score.
// Initialize Mixpanel
mixpanel.init('YOUR_TOKEN');
// Track key engagement events
mixpanel.track('Feature Used', {
'feature_name': 'dashboard_view',
'time_spent': 120,
'user_type': 'premium'
});
mixpanel.track('API Call Made', {
'endpoint': '/users',
'status_code': 200
});
mixpanel.track('Report Generated', {
'report_type': 'custom',
'data_points': 500
});Set user properties to track engagement dimensions
Use mixpanel.people.set() to store engagement-related properties on user profiles. These become queryable dimensions in Segmentation.
// Set engagement properties on the user profile
mixpanel.people.set({
'total_events_this_month': 45,
'days_active_this_month': 20,
'feature_adoption': ['dashboard', 'reports', 'api'],
'account_tier': 'premium',
'last_active': new Date()
});
// Increment engagement counters
mixpanel.people.increment('total_engagements', 1);
mixpanel.people.increment('api_calls_this_month', 1);Use super properties to add context to all events
Set super properties once to include them in every subsequent event. This adds segment or cohort information without repeating it in every track() call.
// Set super properties
mixpanel.register({
'customer_segment': 'enterprise',
'onboarded_date': '2024-01-15',
'region': 'US-East'
});
// All future events will include these properties
mixpanel.track('Report Generated');
// Event automatically includes customer_segment, onboarded_date, regionAnalyze Engagement Patterns in Segmentation
Once events are flowing, query them to identify engagement patterns and measure trends over time.
Build a segmentation query to measure engagement
Navigate to Segmentation in Mixpanel and filter users by event frequency and properties. You can count active users, measure feature adoption, or drill into specific cohorts.
// Query user engagement via the Data API
const params = new URLSearchParams({
'data_grouping': 'singular',
'unit': 'month',
'event': 'Feature Used'
});
fetch(
`https://data.mixpanel.com/api/2.0/segmentation?${params}`,
{
headers: {
'Authorization': 'Basic ' + btoa('SERVICE_ACCOUNT:SECRET')
}
}
)
.then(res => res.json())
.then(data => {
console.log('Monthly engagement:', data.results);
});Save a daily engagement report
In Segmentation, build a query showing your engagement metric (e.g., "users with 5+ Feature Used events this month"). Click Save Report, name it, and pin it to your dashboard for quick daily checks.
Create engagement cohorts for targeting
In Cohorts, create segments like "High Engagement" (10+ events this month) and "At Risk" (fewer than 2 events). Use these in feature flags, email campaigns, or support prioritization.
Monitor Long-Term Engagement with Retention
Retention analysis shows whether users stay active over time—the truest signal of sustainable engagement.
Set up retention analysis for your core feature
In Retention, select a "starting event" (e.g., "Dashboard Viewed") and a "returning event" (e.g., "Feature Used"). Mixpanel shows the percentage of users who returned in week 1, 2, 3, etc.
// Track feature interactions for retention measurement
mixpanel.track('Dashboard Viewed', {
'dashboard_type': 'custom',
'time_spent': 300,
'filters_applied': 2
});
mixpanel.track('Metric Added to Dashboard', {
'metric_name': 'conversion_rate',
'chart_type': 'line'
});
// In Mixpanel UI, configure Retention:
// Starting Event: "Dashboard Viewed"
// Returning Event: "Metric Added to Dashboard"
// Cohort Size: All users
// Interval: WeeklyBreak retention down by segment
Add a Breakdown dimension (e.g., user_type or account_tier). This reveals whether premium users, free users, or specific cohorts have different retention—a strong signal of engagement quality differences.
Common Pitfalls
- Treating raw event count as engagement. 100 events from someone frantically clicking isn't the same as 100 intentional feature uses. Pair frequency with properties like
feature_adoption_countortime_spentto measure quality. - Skipping user properties and relying only on events. Without
people.set(), you can't segment by engagement properties in Segmentation. You'll see only raw event counts, not patterns. - Confusing daily active users with engagement. High DAU but low feature diversity means users log in but don't explore. Monitor feature adoption alongside login frequency.
- Ignoring cohort decay over time. A cohort that was 80% engaged three months ago might be 40% engaged now. Run retention curves by onboarding date to catch declining engagement early.
Wrapping Up
You've now built a multi-layered engagement monitoring system in Mixpanel: tracking events, setting properties, analyzing segments, and measuring retention curves. This gives you visibility into both new user engagement and long-term retention patterns. If you want to track this automatically across tools, Product Analyst can help.