Solved

Is it possible to retrieve the current MTU value via any API?

  • 25 July 2019
  • 4 replies
  • 25 views

Badge

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.


icon

Best answer by mikesnare 31 July 2019, 15:10

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.


View original

4 replies

Userlevel 1
Badge

Hi @mikesnare, I do not believe this information if available to get via their API. I know that we get emailed if we get close to hitting our limit to help us either slow down tracking or might need to upgrade to a higher volume of MTUs.

However this is actually an interesting Idea being that they just switched to their MTU model and could be very useful for us too. Might be worth posting an Idea here for them to consider implementing.


Badge

Yeah, I contacted support as well, and they said the same thing. There is no way to get this value except for pulling the data via raw export and doing the math yourself. I'm trying that, but the numbers are off. They really need to add an API for this or people are going to blow through their limits pretty easily.


Userlevel 4
Badge +4

@mikesnare @fredl Thank you for sharing this feedback! We filed a product gap on your behalf here with our Engineering and Product Development team. Make sure you are following the Idea - via the button in the upper right hand corner - to get emailed updates on its progress.


Badge

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.


Reply