6 min read

How to Calculate DAU WAU MAU in Mixpanel

DAU, WAU, and MAU tell you how many distinct users return to your product daily, weekly, and monthly—these are the core metrics for measuring engagement and retention. In Mixpanel, you can surface these numbers directly from the Retention report, but if you need custom time windows, programmatic access, or integration with other systems, you'll need to query the raw event data and calculate them yourself.

Using Mixpanel's Retention Report for Quick Visibility

Mixpanel's built-in Retention view is the fastest way to see DAU, WAU, and MAU without writing any code.

Open the Retention Report

Navigate to Insights > Retention in your Mixpanel dashboard. Select the event that represents user activity (e.g., page_view, app_open, or login). This is the event that fires whenever a user is active in your product.

Choose Your Time Grouping

In the retention table, click the time period dropdown and select Day for DAU, Week for WAU, or Month for MAU. Mixpanel automatically counts unique distinct_id values for each period and displays the cohort sizes.

Apply User Filters if Needed

Click Add Filter to segment by user properties (plan tier, signup date, region, etc.). The distinct user count shown is your DAU, WAU, or MAU for that segment.

javascript
// Ensure events are tracked with a consistent, stable distinct_id
mixpanel.identify(userId);
mixpanel.track('page_view', {
  'url': window.location.href,
  'timestamp': Math.floor(Date.now() / 1000)
});
Identify users and track events consistently so Mixpanel can count them in retention reports
Tip: Mixpanel's distinct_id must be stable and consistent. If you mix anonymous and logged-in tracking without aliasing, you'll overcount users.

Exporting Raw Events and Calculating Metrics Programmatically

For custom dashboards, scheduled reports, or to integrate with your data warehouse, use Mixpanel's Data Export API to fetch events and calculate DAU/WAU/MAU yourself.

Get Your Service Account Token

In Mixpanel, go to Project Settings > Service Accounts. Create a new service account or use an existing one, then copy the Token. This authenticates your API requests.

Fetch Events via the Export API

Call the Data Export endpoint with your token, start date, and end date. The response is newline-delimited JSON—each line is one event object.

javascript
const axios = require('axios');
const { Buffer } = require('buffer');

const token = process.env.MIXPANEL_EXPORT_TOKEN;
const fromDate = '2026-03-20';
const toDate = '2026-03-26';

const auth = Buffer.from(token + ':').toString('base64');
const { data } = await axios.get(
  'https://data.mixpanel.com/api/2.0/export',
  {
    params: { from_date: fromDate, to_date: toDate },
    headers: { Authorization: `Basic ${auth}` }
  }
);

const events = data
  .split('\n')
  .filter(line => line.trim())
  .map(line => JSON.parse(line));
Fetch events from the Mixpanel Data Export API

Calculate DAU by Grouping Distinct Users per Day

Iterate through events and track unique distinct_id values for each day. The count of unique IDs is your DAU for that day.

javascript
const dau = {};

events.forEach(event => {
  // event.properties.time is Unix seconds, not milliseconds
  const date = new Date(event.properties.time * 1000)
    .toISOString()
    .split('T')[0];
  
  if (!dau[date]) dau[date] = new Set();
  dau[date].add(event.properties.distinct_id);
});

const dauMetrics = Object.entries(dau)
  .map(([date, ids]) => ({ date, dau: ids.size }))
  .sort((a, b) => new Date(a.date) - new Date(b.date));

console.log(dauMetrics);
Count distinct users per day to get DAU

Calculate WAU and MAU Using the Same Events

For WAU, group by ISO week number using getISOWeek() or similar; for MAU, group by year-month (e.g., 2026-03). Use the same event stream and distinct_id logic as DAU.

Watch out: The Data Export API has rate limits (100 requests per hour). Cache results and batch your requests. Also, event.properties.time is in Unix seconds, not milliseconds—always multiply by 1000 before constructing a JavaScript Date.

Common Pitfalls

  • Mixing anonymous and logged-in distinct_id values without aliasing — Mixpanel counts them as separate users, inflating DAU/WAU/MAU. Use mixpanel.alias() to merge user IDs before and after login.
  • Forgetting to multiply time by 1000 — Mixpanel exports time in Unix seconds, but JavaScript Date expects milliseconds. Always convert: new Date(event.properties.time * 1000).
  • Ignoring timezone offsets — Mixpanel reports in UTC by default. If your business operates in a different timezone, your date boundaries may not align with your actual business day.
  • Choosing sporadic or unreliable events — Pick high-volume, frequent events like page_view or app_open. Rare or conditional events give inaccurate metrics.

Wrapping Up

You now have two practical ways to surface DAU, WAU, and MAU in Mixpanel: use the Retention report for quick visibility, or export raw events and calculate programmatically for custom dashboards and integrations. Both rely on stable, consistent distinct_id tracking. If you want to track these metrics automatically across tools without manual calculation, Product Analyst can help.

Track these metrics automatically

Product Analyst connects to your stack and surfaces the insights that matter.

Try Product Analyst — Free