Querying Mixpanel using JQL from the Terminal

jql-terminal.png

Mixpanel provides a way to query the data you send to it using something they call JavaScript Query Language (JQL).

To experiment with it, you can navigate to the JQL app for your project:

Screen Shot 2018-04-09 at 4.07.17 PM.png

Which takes you to the JQL editor:

Screen Shot 2018-04-09 at 4.07.50 PM.png

Alternatively, you query Mixpanel’s JQL endpoint directly from a local script:

First, you need to create a file with the JQL. I called mine testing.js:

Next, grab your project’s API Secret from its settings.

Finally, execute the JQL:

$ curl --silent https://mixpanel.com/api/2.0/jql -u YOUR_API_KEY: --data-urlencode script@testing.js | python -m json.tool

The last part that pipes to python simply formats the JSON response when it’s displayed in the terminal for easy viewing:

This is a trivial example obviously, but there’s a lot more you can do with JQL. You can use JQL to perform any type of analysis that you can in Mixpanel itself, and more.


			

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s