Your DAU/MAU ratio tells you what percentage of monthly users come back each day—critical for spotting engagement trends early. Amplitude gives you the raw numbers directly from event data, but you need to know where to find them and how to query them correctly.
Track Active Users with Events
Before calculating DAU/MAU, ensure your events have proper user identification so Amplitude can count unique users accurately.
Initialize the SDK with a user ID
Set a stable user identifier using setUserId() so Amplitude can track the same person across sessions and devices. This is critical—without it, Amplitude defaults to device ID, which inflates your user counts.
import * as amplitude from '@amplitude/analytics-browser';
amplitude.init('API_KEY', '[email protected]');
amplitude.setUserId('user123');
amplitude.track('Session Start');Track events that represent engagement
Send any event that represents active usage: page views, button clicks, API calls, purchases. Amplitude counts unique users per event per day, so pick an event that fires when users engage (not every trivial action).
amplitude.track('Feature Used', {
feature_name: 'dashboard_view',
session_id: 'sess_12345',
timestamp: Date.now()
});Calculate DAU and MAU Using Amplitude's Dashboard
The easiest path: grab both numbers from Amplitude's UI, then divide. No API needed.
Find DAU in the Events dashboard
Open Analytics > Events, select a key event (e.g., Feature Used), set the time range to Last 24 hours, and note the Unique Users count. That's your DAU.
// Example: Use Amplitude's REST API to fetch DAU programmatically
const getDAU = async () => {
const today = new Date().toISOString().split('T')[0].replace(/-/g, '');
const yesterday = new Date(Date.now() - 86400000).toISOString().split('T')[0].replace(/-/g, '');
const response = await fetch('https://api2.amplitude.com/2/events', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
data_source: 'event_stream',
start: yesterday,
end: today,
metrics: [{ name: 'active_users' }]
})
});
const data = await response.json();
return data.result[0].values[0]; // DAU
};
getDAU().then(dau => console.log(`Today's DAU: ${dau}`));Find MAU in the Users dashboard
Switch to Users, filter by Last 30 days, and record the total user count. You can add property filters (plan tier, signup cohort) if you want to segment MAU by user type.
// Set user properties to segment your MAU calculation
amplitude.identify(
new amplitude.Identify()
.set('plan_tier', 'paid')
.set('company_size', 'enterprise')
.set('signup_date', '2026-01-15')
);
amplitude.track('User Identified');Divide DAU by MAU
Once you have both numbers, the math is simple: DAU ÷ MAU. A ratio of 0.25 means 25% of your monthly users return daily. Ratios above 0.3 indicate strong engagement; below 0.1 suggests retention risk.
Automate DAU/MAU Calculation with APIs
For production monitoring and reporting, query Amplitude's API directly. This lets you pull DAU/MAU into dashboards or trigger alerts.
Query DAU via the Events API
Call Amplitude's Events API with a 24-hour window. Extract the unique user count to get DAU. Include your API key in the Authorization header.
const queryDAU = async (eventName, date) => {
const dateStr = date.toISOString().split('T')[0].replace(/-/g, '');
const response = await fetch('https://api2.amplitude.com/2/events/segmentation', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
event: eventName,
start: dateStr,
end: dateStr,
group_by: [{ name: 'user_id' }]
})
});
const data = await response.json();
return data.series[0].length; // Count of unique users
};
queryDAU('Feature Used', new Date()).then(dau => console.log(`DAU: ${dau}`));Query MAU via the Users API
Use a 30-day window with the Users endpoint. Filter by last active date or event occurrence to exclude dormant users if desired.
const queryMAU = async (days = 30) => {
const endDate = new Date().toISOString().split('T')[0].replace(/-/g, '');
const startDate = new Date(Date.now() - days * 86400000).toISOString().split('T')[0].replace(/-/g, '');
const response = await fetch('https://api2.amplitude.com/2/users/activity', {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_date: startDate,
end_date: endDate
})
});
const data = await response.json();
return data.users.length; // Count of unique active users in 30 days
};
queryMAU().then(mau => console.log(`MAU: ${mau}`));Calculate and monitor the ratio
Divide DAU by MAU and store the result. Compare day-over-day or week-over-week to spot engagement trends. A declining ratio signals churn; a rising ratio means your retention is improving.
Common Pitfalls
- Not setting user IDs—Amplitude falls back to device ID, so the same user on two devices counts as two users, inflating DAU/MAU
- Inconsistent event selection—If you count DAU from 'Page View' but MAU from 'Any Event', the ratio becomes meaningless. Define your 'active user' event upfront
- Ignoring time zones—Amplitude logs in UTC. Your 'last 24 hours' may not align with your product's definition of a day. Adjust your queries accordingly
- Missing property filters—If you segment one calculation (e.g., DAU by paid_tier) but not the other, your ratio will be wrong
Wrapping Up
DAU/MAU ratio is one of the first signals of product health—anything above 0.2 is respectable, 0.3+ is strong engagement. In Amplitude, you can pull it from the dashboard in seconds or automate it via API for continuous monitoring across time. If you want to track this metric automatically across all your tools and trigger alerts when engagement drops, Product Analyst can help.