Obvious Ideas

From the desk of a Software Developer

Archive for the ‘mixpanel’ tag

Using Mixpanel API In Google App Engine Applications (Python)

View Comments

We started using MixPanel to get realtime statistics on user engagement in our application. We’ve been using MixPanel before for funnel tracking, but you can’t really appreciate their service until you start using their event tracking. It is truly realtime (as advertised) – the second the user performs an action on your application, you see it on your dashboard.

Besides the realtime reporting what I really like about MixPanel is the fact that they allow easily reporting from your backend and not only from frontend/Javascript (as opposed to Google Analytics).

Within their documentation they have code samples in many languages, including Python. But their Python sample requires ability to start new processes on the server you’re running – something not possible on App Engine. Therefore I changed it to use URLFetch in RPC mode (so that calls to Mixpanel won’t block the call):

It could be re-factored more, like allowing setting the project token outside the function call, but that I will leave for you to do :) (and if you do, please share with us)

Arik

Written by Arik

December 14th, 2009 at 7:21 pm