How to get Mixpanel data into Spreadsheets and then in Geckoboard


Hi guys,

I wanted to share what I’m currently working on for work in the hopes that it might be useful for someone. I just started at a new company a couple of months ago and after going through my onboarding I realised a lot of work can be done more efficient if we implement Mixpanel across our different platforms. After a month or so we managed to create a pretty good data structure with events and properties for our most important metrics and some nice-to-have details for funnels, segmentations and measuring campaign performance in relation to retention & engagement metrics.

Of course, now I need to share this data with my team which is around the globe and working in different markets. So judging by what other systems they use I decided to use Geckoboard due to it’s integrations, UI and “feel”. Cyfe was cheaper, but damn it’s ugly and it caused me too many frustrations…

Every dashboard is different because every company is different, makes sense, right? We wanted to display our core metrics and establish projections for the whole month and display how close we are to reaching our goals.

This is easier said then done, and ofcourse we need to find some workarounds to achieve this.
Due to Mixpanel being fully integrated, it was easy to grab and display the events I wanted with the proper segmentation. What was a bit harder is to see how can we put this number into perspective and motivate people to reach their goals.

Most of the custom widget magic happens in spreadsheets, so I tried to import the data from Mixpanel first into GoogleSpreadsheets and have it updated automatically. After some awkward failed attempts I stumbled on Melissa’s js script and it’s saved my ass.

Grab Segmentation Data from Mixpanel and dump in Spreadsheets:

This allows you to:

  • grab data for any event and property
  • trigger running the code daily or even every minute
  • stop manually import/export stuff all the time

I’ve mentioned that we need to include projections as well. The projections are calculated by establishing an daily average in the current month and multiplying by the number of days in the current month. Some formulas really came in handy for this:

Get today’s date

day in this month:
H1=today’s date

days remaining this month (not including today):

days past including today

The result is something like this:

Next on the to-do list, is to get the result of a formula into the dashboard…


Hey Vlad, this is awesome! Thanks for sharing this with everyone :smiley:

As for getting formulas, as I was exploring this from another topic, here’s the format it expects (though officially this is an undocumented part of their API):

Root URL -

Query parameters example

          "queries": [
               {"events": ["signup"], "count_type": "unique"},
               {"events": ["Added User"], "count_type": "unique", "selector": "(properties[\"$os\"] == \"Mac OS X\") and \"y\" in properties[\"billing\"]"},
          "formula": "(A)/(B)"

Formula tells the API how to compute the… formula.

  • If you think of the queries as being labelled A to H (in the order they’re listed) then this is an expression of how to combine them.
  • There can be up to 4 elements in the numerator and up to 4 in the denominator and always looks like (numerator)/(denominator) - even if there’s only one thing there - eg (A)/(B).
  • Numerator and denominator are any valid mathematical expression using +,-,* and (). For example (A+(B-(C*D))/((E-F)*G+H).

It looks like that Melissa’s script above could be modified to use these parameters – having a quick look you’d need to modify line 125 where the root API URL is defined (it’s hard coded to use the segmentation endpoint). Then get a bit clever with how it handles the API_PARAMETERS e.g. line 193 defines that the request should be sent with

        'event=' + parametersEntry[0],
        'where=' + parametersEntry[1],
        'type=' + parametersEntry[2],
        'unit=' + parametersEntry[3],

where parametersEntry is defined as

var parametersEntry = API_PARAMETERS[sheetName];

I might be able to jump into this soon to help - let me know if you give it a try!

Mixpanel equations

This is great, I choose the easy way as our formula is pretty simple, but I think others would find this script useful. Maybe you can fork it from Melissa and modify to work with formulas as well. Thanks for the explanation, soon enough I will have to work with more formulas and this helps :slight_smile:


Really great job with this!


Thanks gidea for the info.

Do you know if there’s a way to add people property as a segmentation option? I tried a people property in “where” and everything was undefined.


Hi Arun,

Could you share what query you tried?

The script itself provides this guidance:

 * Step 4) Define Segmentation Queries - Get data for an event, segmented and filtered by properties.
 * Format is: 'Sheet Name' : [ 'event', 'where', 'type', 'unit' ],
 * For example: 'Sign Ups' : [ '$signup', '(properties["Platform"])=="iPhone" and (properties["mp_country_code"])=="GB"', 'general', 'day' ],
 * For full details on Segmentation Queries
 * Sheet Name - What you want the sheet with your data to be called.
 * event - The event that you wish to segment on.
 * where - The property expression to segment the event on.
 * type - This can be 'general', 'unique', or 'average'.
 * unit - This can be 'minute', 'hour', 'day', or 'month'.

As well, here is the Mixpanel reference: