Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Step one of Mixpanel Platform's DAU/MAU by country tutorial
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="">
<link rel="stylesheet" type="text/css" href="">
<script src=""></script>
<body class="mixpanel-platform-body">
var eventName = 'Button clicked'; // replace with event name of your choice
var $dau = MP.api.segment(eventName, 'mp_country_code', { // use segment query on eventName, and segment the data by country
from: moment().subtract(30, 'days'), // 'from' date should be one month ago
to: moment().subtract(1, 'days'), // 'to' date should be yesterday; partial data for today impacts DAU more than it does MAU
unit: 'day', // we want the number of button clicks for each day of the month
type: 'unique' // daily counts should be unique; multiple clicks by the same person in one day should be counted only once
$dau.done(function(results) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment