Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A gevent and REDIS based queue for creating a MixPanel event with Python.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.



This is a basic sample that shows how to create a queue for processing events to MixPanel.

We build the event and push it to a REDIS queue, then consume the task through a gevent based worker which will run "forever" popping tasks off the REDIS queue and submitting them to MixPanel - this way you can have a very high performing queue that's asynchronous and won't slow down your main code waiting for MixPanel to respond.

There are two files:

  • - Contains two main functions, build_event which builds a dictionary containing the event and properties you want to pass to MixPanel and track which logs the event after it is popped off the REDIS queue to mixpanel.

I was going to combine the REDIS logic into the build_event, but left this out (although I've included a sample) because you might want to use with your own queuing system (Celery for example).

  • - A gevent based worker that will run indefinitely, popping MixPanel events off a REDIS queue and submitting them to MixPanel.


To run this successfully, you'll need:

Running the worker

There is a script included, if you start the worker like this:

$ &

It will happily run in the background, shutting itself down every 1000 events and restarting without dropping a beat. We run them like this in production - they are very long running processes and will keep happily chugging away without a hiccup.

Something went wrong with that request. Please try again.