Use Google App Scripts to import Mixpanel data to Google Sheets

You can use the Google App Script platform to get data automatically from Mixpanel into Google Sheets, and then creating a new Spreadsheets widget. For more information and step-by-step instructions visit melissaguyre's mixpanel segmentation script.

This script allows you to:

  • Grab data for any event and property
  • Trigger running the code daily, or even every minute
  • Stop manually importing or exporting data continually

Note

This app has been created by a third-party. It's inclusion on our Help Center shouldn't be treated as an endorsement or recommendation.

Visualizing Mixpanel formulas in Geckoboard

It's possible to graph Mixpanel formulas using Geckoboard's Spreadsheets integration.

Example

formulas=[
     {
          "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)"
     }
]

Syntax

  • from_date
  • to_date
  • unit – day / week / month
  • count_type can be general (which means total), unique, average
  • selector is an expression, which you can learn more from Mixpanel's documentation

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).

Melissaguyre's mixpanel segmentation script could be modified to use these parameters. You’d need to modify line 125 where the root API URL is defined (it’s hard coded to use the segmentation endpoint). Then you'd need to modify how it handles the API_PARAMETERS e.g. line 193, which 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];

Get help

If you're struggling to use this script to graph Mixpanel formulas, drop us a line.

Note

We do have a Mixpanel integration with the following widgets:

  • Trends Number:
    Display the count for a specific event/property in a period with optional comparison period
  • Retention Bar Chart:
    Visualises completion rate over time for events as a bar chart, with optional goal line
  • Trends Union Number:
    Display a count for multiple events in a period with optional comparison period
  • Top Event Property List:
    Display a list of the top properties for an event
  • Trends Bar Chart:
    Display a bar chart of events with a property
  • Revenue Number:
    Display revenue for all or a specific property in a period with optional comparison period
  • Funnel Completion Rate Number:
    Display the completion rate of a funnel
  • Funnel:
    Displays Mixpanel event funnels
  • Funnel Completion Rate Line Chart:
    Visualises the completion rate of a funnel over time as a line chart
  • Revenue Line Chart:
    Display a line chart of revenue data over time
  • Trends Line Chart:
    Visualises event count over time as a line chart
Was this article helpful?

Awesome! 👍  Thanks so much for your feedback!