Your DAU/MAU ratio tells you how sticky your product is—whether monthly users are coming back regularly or dropping off. In Amplitude, you can build this metric in real-time on your dashboard, or query it programmatically whenever you need it. Here's how.
Building a DAU/MAU Chart in the Dashboard
The quickest way to monitor this ratio is with Amplitude's chart builder. You'll set up two metrics—one counting daily active users, one counting monthly active users—then divide them.
Create a Segmentation chart for DAU
In the Events tab, click Create and select Segmentation. Choose any event that represents active usage (e.g., page_view). Set the metric to User Composition > Count and the time bucket to Daily. This gives you daily active users by date.
import * as amplitude from '@amplitude/analytics-browser';
amplitude.init('YOUR_API_KEY');
// Send page view event for DAU tracking
amplitude.track('page_view', {
page_path: window.location.pathname,
timestamp: Date.now()
});Set up a second chart for MAU
Create another Segmentation chart with the same event, but set the time bucket to Monthly. This counts unique users per month. You now have both DAU and MAU data visible.
// Amplitude automatically tracks user monthly via unique user_id
amplitude.setUserId('user123');
// Every event includes the user_id for monthly deduplication
amplitude.track('login', {
login_method: 'email'
});Create a formula chart to divide them
Click the + button to add a new metric, then select Formula. Enter DAU / MAU * 100 to get a percentage. Amplitude will plot the ratio over time. Watch for seasonality—weekends often show lower ratios.
// Formula charts are created in the Amplitude dashboard UI
// No SDK code required; set your formula in the chart builder
// Example formula: (daily_count / monthly_count) * 100Querying DAU/MAU Programmatically via the Events API
For dashboards outside Amplitude or automated reporting, use the Events API to fetch aggregated user counts and compute the ratio server-side.
Get DAU for a specific date range
Call the Events API with your core event and group_by set to ["day"]. Amplitude returns unique user counts per day. Include limit large enough to avoid pagination.
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const SECRET_KEY = 'YOUR_SECRET_KEY';
const auth = Buffer.from(`${API_KEY}:${SECRET_KEY}`).toString('base64');
const response = await axios.get('https://amplitude.com/api/2/events', {
params: {
start: '20240101T00',
end: '20240131T23',
event: 'page_view',
group_by: ['day'],
limit: 10000
},
headers: {
'Authorization': `Basic ${auth}`
}
});
console.log(response.data.data.events);Calculate MAU from the API response
For a rolling 30-day MAU, make the same API call but group_by ["month"]. Or calculate client-side: count unique user_id values across the entire response. Amplitude's cohort API also returns exact MAU counts if you've pre-built a cohort.
const mauResponse = await axios.get('https://amplitude.com/api/2/events', {
params: {
start: '20240101T00',
end: '20240131T23',
event: 'page_view',
group_by: ['month'],
limit: 10000
},
headers: {
'Authorization': `Basic ${auth}`
}
});
const uniqueUsers = new Set();
mauResponse.data.data.events.forEach(event => {
uniqueUsers.add(event.user_id);
});
const mau = uniqueUsers.size;
console.log('Monthly Active Users:', mau);Compute and store the ratio
Divide the average DAU by MAU and multiply by 100 for a percentage. Insert this into your own database or send it to Slack for alerting.
const dau = 15000; // average from daily counts
const mau = 50000; // from monthly aggregation
const ratio = (dau / mau) * 100;
console.log(`DAU/MAU Ratio: ${ratio.toFixed(2)}%`);
// Store in your database
await db.query(
'INSERT INTO metrics (date, metric, value) VALUES (?, ?, ?)',
[new Date(), 'dau_mau_ratio', ratio]
);Filtering by User Segments with Cohorts
Sometimes you want DAU/MAU for specific segments—paying users, a particular region, or early adopters. Use cohorts to isolate them.
Create a cohort for your segment
Go to Cohorts and click Create. Define your segment—e.g., users with property plan = 'premium' or signup_date > '2024-01-01'. Save; Amplitude tracks membership in real-time.
// Set user properties to enable cohort filtering
amplitude.setUserProperties({
plan: 'premium',
signup_date: '2024-01-15',
region: 'us-east',
ltv_tier: 'high'
});
// These properties are sent with every event
amplitude.track('feature_used', {
feature: 'export_report'
});Filter your DAU/MAU chart by cohort
Open your DAU/MAU chart, click Filter, and select your cohort. Amplitude recalculates the ratio for users in that cohort only. You now see if premium users are stickier than free users.
// Cohort filtering happens in the Amplitude UI
// Ensure properties are set before events fire
amplitude.identify(
new amplitude.Identify()
.set('cohort', 'premium_users')
.set('churn_risk', false)
);Common Pitfalls
- Counting events instead of users. If page_view fires 5 times per user per day, your DAU is inflated by 5x. Always use User Composition > Count in Amplitude charts to count unique users only.
- Confusing MAU timing. Amplitude's rolling 30-day MAU differs from calendar-month MAU. Document which window you're using in your reports—Jan 1–31 vs. Dec 2–Jan 31.
- Inconsistent event names across platforms. If your web app tracks
page_viewbut mobile trackspage_viewed, you're undercounting DAU. Standardize event names. - Ignoring timezone offsets. Amplitude's daily bucket defaults to UTC. For users across timezones, activity spikes may split awkwardly at midnight UTC. Adjust in chart settings if needed.
Wrapping Up
Monitoring DAU/MAU is a simple health check: are your users coming back? In Amplitude, you can build this ratio in under five minutes with Segmentation charts, or query it via the Events API for automation. If you want to track this across all your analytics tools and get a unified view, Product Analyst can help.