Engagement scores let you quantify how active each user is and flag at-risk accounts early. In Mixpanel, you build this by tracking weighted events and rolling the total into a user property—then slice your data by score.
Track Engagement Events with Weights
Start by tracking the actions that signal engagement: feature clicks, searches, submissions, payments. Assign each action a weight that reflects its business value.
Initialize Mixpanel and Track Events
Add the Mixpanel SDK to your app and track engagement events. Find your project token in Settings > Project Settings in the Mixpanel UI.
import mixpanel from 'mixpanel-browser';
// Initialize Mixpanel
mixpanel.init('YOUR_PROJECT_TOKEN', { track_pageview: false });
mixpanel.identify('user_123');
// Track an engagement event
mixpanel.track('Feature Used', {
feature_name: 'Export Data',
weight: 5
});Define Event Weights by Importance
Different actions have different business value. A page view might be weight 1, feature usage is weight 5, a purchase is weight 25. Include the weight as a property on each event.
// Low-value action: page view
mixpanel.track('Page Viewed', {
page: 'pricing',
weight: 1
});
// Medium-value action: feature interaction
mixpanel.track('Feature Used', {
feature: 'dashboard',
weight: 5
});
// High-value action: purchase
mixpanel.track('Purchase Completed', {
plan: 'pro',
amount: 99,
weight: 25
});Update Engagement Score with Each Event
Use Mixpanel's People API to increment a user's score each time they perform an engagement action. This creates a running total you can segment on.
Increment Score After Client-Side Events
For browser events, directly increment the engagement_score user property right after tracking the event using mixpanel.people.increment().
// After tracking an event, increment engagement score
mixpanel.track('Feature Used', { feature: 'export' });
mixpanel.people.increment('engagement_score', 5);
// High-value action
mixpanel.track('Purchase Completed', { amount: 99 });
mixpanel.people.increment('engagement_score', 25);
// With optional callback
mixpanel.people.increment('engagement_score', 10, function() {
console.log('Score updated');
});Update Score Server-Side via API
For events originating on your backend (webhooks, purchases, API calls), use the Mixpanel People API endpoint. You'll need your project token.
// Node.js backend: increment engagement score
async function updateScore(userId, points) {
const token = 'YOUR_PROJECT_TOKEN';
const dataObject = {
$token: token,
$distinct_id: userId,
$add: { engagement_score: points }
};
const encodedData = Buffer.from(
JSON.stringify(dataObject)
).toString('base64');
const response = await fetch('https://api.mixpanel.com/engage', {
method: 'POST',
body: `data=${encodeURIComponent(encodedData)}`
});
return response.ok;
}
// Usage: add 25 points after purchase webhook
await updateScore('user_123', 25);Initialize Score on Signup
When a new user signs up, set their initial engagement_score to 0 using mixpanel.people.set().
// On successful signup
mixpanel.identify('new_user_456');
mixpanel.people.set({
$first_name: 'Jane',
$email: '[email protected]',
engagement_score: 0,
signup_date: new Date().toISOString()
});engagement_score_30d and reset it monthly.Segment and Analyze by Engagement Score
With engagement scores stored, segment your user base by score tier and measure how power users convert and retain differently.
Create User Segments in Mixpanel UI
In Segmentation, create filters for engagement score ranges. Build segments for power users (score > 100), active users (score 20–100), and inactive users (score < 20). See how many users fall into each tier.
// Track an event with engagement tier context (for analysis)
mixpanel.track('User Viewed Dashboard', {
engagement_tier: 'power_user', // computed from score
session_length: 300,
features_used: ['export', 'filters', 'custom_metrics']
});
// Then in Mixpanel UI:
// 1. Go to **Segmentation**
// 2. Add filter: **engagement_score** > 100
// 3. View count and breakdown of power users
// 4. Compare against engagement_score < 20 segmentMeasure Conversion Funnel by Score Tier
In Funnels, add events that represent your activation or purchase flow. Filter by engagement score to compare power users' conversion rates against low-engagement users.
// Track funnel steps
mixpanel.track('Started Upgrade Flow', {
source: 'dashboard',
engagement_score_at_event: 50 // current user score
});
mixpanel.track('Viewed Pricing', {
engagement_score_at_event: 50
});
mixpanel.track('Completed Upgrade', {
engagement_score_at_event: 50,
new_plan: 'pro',
amount: 99
});
// In Mixpanel UI:
// 1. **Funnels** > New Funnel
// 2. Add: Started Upgrade → Viewed Pricing → Completed Upgrade
// 3. Add filter: **engagement_score** > 50
// Compare power users' conversion to engagement_score < 20Common Pitfalls
- Mixing client-side and server-side increments for the same user—you can double-count the score. Pick one path and stick to it consistently.
- Never resetting the score—after months, engagement scores lose meaning (power users and new users both have high scores). Implement a monthly reset or use a rolling window like
score_this_month. - Assigning weights without testing—weights should match your business model. A page view worth 1 point and a purchase worth 25 might not reflect your actual priorities. Test and refine.
- Forgetting to backfill historical users—if you start mid-stream, new users build scores while existing power users start at zero. Backfill with historical event data or accept incomplete early comparison.
Wrapping Up
You now track engagement scores by weighting events and rolling the total into a user property. Use this to segment power users, optimize activation funnels, and predict churn. If you want to track engagement automatically and standardize it across your entire analytics stack, Product Analyst can help.