DAU, WAU, and MAU are the north star metrics for any product — they tell you if users are actually coming back. Mixpanel doesn't calculate these automatically; you need to define what 'active' means for your product, track the right events, and build reports that measure recurring engagement over time.
Track Core User Activity Events
Active users are defined by behavior. You need to send events for the key actions that signal a user is genuinely engaged with your product.
Initialize Mixpanel and Identify Users
Start by initializing the Mixpanel JavaScript SDK and calling mixpanel.identify() with a unique user ID. This ensures all subsequent events are attributed to that user, which is critical for calculating unique user counts across time periods.
import mixpanel from 'mixpanel-browser';
// Initialize Mixpanel with your project token
mixpanel.init('YOUR_PROJECT_TOKEN', { debug: false });
// Identify the user (call this after login or signup)
const userId = user.id; // e.g., 'user_12345'
mixpanel.identify(userId);
// Set user properties for segmentation
mixpanel.people.set({
$email: user.email,
$name: user.name,
plan: 'pro'
});Track Events That Define 'Active'
Send an event when a user does something meaningful — log in, view a dashboard, run a query, create a chart. Pick 1–3 core actions that best represent engagement. This event becomes your definition of DAU/WAU/MAU.
// Track a login or session start
mixpanel.track('User Active', {
session_id: generateSessionId(),
user_type: 'premium'
});
// Or track a specific feature use
mixpanel.track('Dashboard Viewed', {
dashboard_id: 'dash_789',
view_type: 'saved_chart'
});
// Or track a search/query
mixpanel.track('Query Executed', {
query_type: 'cohort_analysis',
execution_time_ms: 245
});Ensure Timestamps Are Accurate
Mixpanel uses the event timestamp to bucket users into daily, weekly, and monthly cohorts. By default, it uses the server time when the event arrives. For accuracy across time zones, explicitly set the timestamp to the user's local time.
// Mixpanel automatically adds a server-side timestamp,
// but you can override it for accuracy
mixpanel.track('User Active',
{ action: 'login' },
{
// Unix timestamp in milliseconds
timestamp: Math.floor(Date.now() / 1000) * 1000
}
);
// For historical events (e.g., from logs), set the actual time they happened
const eventTime = new Date('2025-03-20T14:30:00Z');
mixpanel.track('Signup Completed',
{ plan: 'pro' },
{ timestamp: Math.floor(eventTime.getTime() / 1000) * 1000 }
);mixpanel.identify(), Mixpanel will count users by their anonymous device ID. This inflates DAU/WAU/MAU if the same user visits on different devices.Build Retention Reports for DAU WAU MAU
Once events are flowing into Mixpanel, use the Retention report to measure how many unique users return each day, week, or month.
Set Up a Retention Report
In Mixpanel, go to Reports > Retention. Select the event that defines an active user (e.g., 'User Active' or 'Dashboard Viewed'). Set the cohort interval to Day to measure DAU, Week for WAU, or Month for MAU. Mixpanel automatically counts distinct users per period.
// Query retention data via Mixpanel's Data API
const response = await fetch(
'https://mixpanel.com/api/2.0/retention?' +
'event=User%20Active&' + // Event that defines active
'unit=day&' + // 'day' for DAU, 'week' for WAU, 'month' for MAU
'from_date=2025-01-01&' +
'to_date=2025-03-26&' +
'api_key=YOUR_API_KEY'
);
const retentionData = await response.json();
console.log('DAU by cohort:', retentionData);Segment by User Properties
You may want DAU/WAU/MAU for specific user groups — e.g., paying users only, or users in a region. In the Retention report, add a filter using Segments. This narrows the count to only users matching that criteria.
// In the Mixpanel UI: Retention > Add filter > Select property
// For example, filter to only users where plan = 'pro'
const filterByPlan = {
property: 'plan',
operator: 'is',
value: 'pro'
};
// API call with filter
const response = await fetch(
'https://mixpanel.com/api/2.0/retention?' +
'event=User%20Active&' +
'unit=day&' +
'where=properties["plan"]%20==%20"pro"&' +
'api_key=YOUR_API_KEY'
);
const paidUserDAU = await response.json();Export and Monitor Trends
Export the retention report to CSV or poll the API daily to track DAU/WAU/MAU over weeks and months. Look for upward or downward trends. A sudden drop in DAU is often a sign of a bug or a change in user behavior.
// Fetch daily DAU and store in your database
async function trackDailyDAU() {
const today = new Date().toISOString().split('T')[0];
const response = await fetch(
`https://mixpanel.com/api/2.0/retention?` +
`event=User%20Active&unit=day&from_date=${today}&to_date=${today}&api_key=YOUR_API_KEY`
);
const data = await response.json();
const dau = data.cohort[0]?.count || 0;
// Store for trend analysis
await db.insert('daily_metrics', { date: today, dau });
return dau;
}
// Run daily via cron or scheduled task
await trackDailyDAU();Set Up Alerts and Dashboards
DAU/WAU/MAU is only useful if you're monitoring it regularly. Build dashboards and alerts so your team notices changes immediately.
Create a Metrics Dashboard
In Mixpanel, create a dashboard with your retention reports front-and-center. Add cards for DAU, WAU, and MAU. Place them next to signups, churn, and feature usage so you can see the full picture of user engagement.
// Example: monitor DAU alongside conversion
// Card 1: Retention report (DAU)
// Card 2: Funnel report (signup → first login → feature use)
// Card 3: Segmentation (DAU by plan type)
// In dashboard, you'll see if DAU stays flat while signups grow
// — that's a sign of poor onboarding or early churnSet Up Email Alerts for Drops
Use Mixpanel's Alerts feature to send email or Slack notifications if DAU drops below your baseline. This catches sudden engagement problems before they become churn.
// In Mixpanel: go to Alerts > Create Alert
// Set up: if DAU < 1000 (or your threshold) for 2 consecutive days, notify team
// Or implement your own via API polling:
async function checkDAUAlert(threshold = 1000) {
const response = await fetch(
`https://mixpanel.com/api/2.0/retention?event=User%20Active&unit=day&from_date=${today}&api_key=YOUR_API_KEY`
);
const data = await response.json();
const latestDAU = data.cohort[0]?.count || 0;
if (latestDAU < threshold) {
await slack.send('⚠️ DAU dropped to ' + latestDAU);
}
}Common Pitfalls
- Not calling
mixpanel.identify()consistently — if you skip this, Mixpanel counts each user multiple times under different anonymous IDs, inflating your DAU/WAU/MAU numbers. - Tracking too many 'activity' events — page views, clicks, hovers — without defining a single core event. This creates noise. Pick 1–3 key actions that genuinely signal engagement.
- Forgetting that retention counts *unique users per period*, not total events — if a user is active on Monday and Tuesday, they count as 1 DAU on Monday and 1 DAU on Tuesday, not 2 DAU total.
- Not accounting for time zone differences — a user in Tokyo and a user in New York might be counted in different 'days' depending on your server clock. Consider standardizing to UTC or the user's local time.
Wrapping Up
DAU, WAU, and MAU are best tracked by defining a core engagement event, sending that event consistently, and running retention reports to measure unique users over time. The key is picking the right event — one that truly signals a user is actively using your product. If you want to track this automatically across tools, Product Analyst can help.