As stated in the subject, I'm wondering if there is some way to pull our MTU value via any API? It would be nice if we could avoid overages automatically by simply stopping our MP tracking when we get close.
Best answer by mikesnare
For those who come after me, this JQL snippet should give you what you need until there's a better API:
var cache = {},
today = new Date(),
prefix = today.getFullYear() + '-' + (today.getMonth() + 1) + '-';
function main() {
return Events({
from_date: prefix + '1', // Always the first of the current month
to_date: prefix + today.getDate() // Always today
})
.filter(function (e) {
var seen = !!cache[e.distinct_id];
if (!seen) {
cache[e.distinct_id] = 1;
}
return !seen;
})
.reduce(mixpanel.reducer.count());
}
You just need to run it once for each project in your organization and sum the results.