All Projects → stpe → mixpanel-engage-query

stpe / mixpanel-engage-query

Licence: other
Command line tool to query the MixPanel Engage API for People Data.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mixpanel-engage-query

WinAnalytics
A light-weight android library that can be quickly integrated into any app to use analytics tools.
Stars: ✭ 23 (-52.08%)
Mutual labels:  analytics, mixpanel
growthbook
Open Source Feature Flagging and A/B Testing Platform
Stars: ✭ 2,342 (+4779.17%)
Mutual labels:  analytics, mixpanel
mixpanel-lite
2.9k alternative to mixpanel-js with offline support for PWAs
Stars: ✭ 49 (+2.08%)
Mutual labels:  analytics, mixpanel
couchdb-prometheus-exporter
CouchDB stats exporter for Prometheus
Stars: ✭ 45 (-6.25%)
Mutual labels:  exporter
cert human
SSL Certificates for Humans
Stars: ✭ 34 (-29.17%)
Mutual labels:  command-line-tool
gee
🏵 Gee is tool of stdin to each files and stdout. It is similar to the tee command, but there are more functions for convenience. In addition, it was written as go
Stars: ✭ 65 (+35.42%)
Mutual labels:  command-line-tool
data-science-best-practices
The goal of this repository is to enable data scientists and ML engineers to develop data science use cases and making it ready for production use. This means focusing on the versioning, scalability, monitoring and engineering of the solution.
Stars: ✭ 53 (+10.42%)
Mutual labels:  analytics
wholesome-cli
Command Line Tool for managing Flutter projects
Stars: ✭ 57 (+18.75%)
Mutual labels:  command-line-tool
metronome
A set of tools for modifying and randomizing Pokémon games
Stars: ✭ 23 (-52.08%)
Mutual labels:  command-line-tool
retour-for-kirby
Kirby 3 plugin to manage redirects and track 404s right from the Panel
Stars: ✭ 96 (+100%)
Mutual labels:  analytics
fontman
Manage and update your installed fonts.
Stars: ✭ 20 (-58.33%)
Mutual labels:  command-line-tool
Awesome-DataScience-Cheatsheets
Collection of cheatsheets for data science, machine learning and deep learning :).
Stars: ✭ 48 (+0%)
Mutual labels:  analytics
netflix-list-exporter
💫‎‎‎‏‏‎ An Extension to export your lists from Netflix to Clipboard area and share it with your friends.
Stars: ✭ 60 (+25%)
Mutual labels:  exporter
swift-commandlinekit
Framework supporting the development of command-line tools in Swift on macOS and Linux. The framework supports managing command-line arguments, provides lightweight functions to deal with escape sequences, and defines an API for reading strings from the terminal.
Stars: ✭ 38 (-20.83%)
Mutual labels:  command-line-tool
core-api
Streamr Core backend
Stars: ✭ 52 (+8.33%)
Mutual labels:  analytics
rclc
Mathematical expression calculator with big integers, floats, common fractions, and complex numbers support
Stars: ✭ 24 (-50%)
Mutual labels:  command-line-tool
ut-cli
A command line tool to handle a unix timestamp.
Stars: ✭ 13 (-72.92%)
Mutual labels:  command-line-tool
pageviews
A simple and lightweight pageviews counter for your WordPress posts and pages.
Stars: ✭ 23 (-52.08%)
Mutual labels:  analytics
php-csv-exporter
A fast and tiny PHP library to export data to CSV based on Generator. Export millions of data seamlessly without memory exception.
Stars: ✭ 15 (-68.75%)
Mutual labels:  exporter
kaltura-player-android
Kaltura Player is a rich, easy to integrate and easy to use video player for all media types and ad scenarios you need. - based on Google ExoPlayer
Stars: ✭ 22 (-54.17%)
Mutual labels:  analytics

Command-line tool to query the Mixpanel Engage API for People Data. With other words, export list of Mixpanel users with selected properties, optionally filtered by query on property values.

This script is especially powerful in combination with mixpanel-engage-post, that allow you to batch post additions/updates/deletion of people profiles, and jq (a command-line JSON processor).

Installation

Install Node.js.

Type npm install --global mixpanel-engage-query

That's it! Run it by typing engage in your terminal.

Setup

To run the script you must specify your Mixpanel API key and secret either as parameters, as environment variables MIXPANEL_API_KEY and MIXPANEL_API_SECRET, in a .env file located in the script's directory (typically useful if you check out the source from Github) or in a .engagerc file in your home directory.

Example of .env and ~/.engagerc file:

MIXPANEL_API_KEY=f49785f7a0yourkey2019c6ba15d71f5
MIXPANEL_API_SECRET=a69ca325ayoursecret4f5ed45cafb66

Example Usage

Get help

$ engage --help

Usage: engage -k [string] -s [string]

Options:
  -k, --key         Mixpanel API key                                    [string]
  -s, --secret      Mixpanel API secret                                 [string]
  -f, --format      Output format, json or csv        [string] [default: "json"]
  -t, --total       Only return total count of results
  -q, --query       A segmentation expression (see Mixpanel API doc)    [string]
  -p, --properties  Properties to output (e.g. '$email,$first_name'). Outputs
                    all properties if none specified.
  -r, --required    Skip entries where the required properties are not set (e.g.
                    '$email $first_name').
  --na, --noarray   Output json as one object per row, instead of one array of
                    objects.
  -u, --url         Only return the URL of query without making the actual
                    request.
  -h, --help        Help                                               [boolean]

Examples:
  engage -q 'properties["$last_seen"] >     Query using expression
  "2015-04-24T23:00:00"'
  engage -p '$email,$first_name'            Limit output to only given list of
                                            comma delimited properties

Note that Mixpanel API key/secret may also be set using environment variables.
For more information, see https://github.com/stpe/mixpanel-engage-query

Get everything

$ engage

Example output:

[
  {
      "$browser": "Chrome",
      "$city": "Kathmandu",
      "$country_code": "NP",
      "$initial_referrer": "$direct",
      "$initial_referring_domain": "$direct",
      "$os": "Windows",
      "$timezone": "Asia/Katmandu",
      "id": "279267",
      "nickname": "bamigasectorone",
      "$last_seen": "2015-04-15T13:07:30",
      "$distinct_id": "15b9cba739b75-03c7e24a3-459c0418-101270-13d9bfa739ca6"
  }
]

Default behaviour is to output the result as an array of entries. Using the noarray flag will instead output one entry per row.

Note that $distinct_id is included as a property for convenience.

Get just the number of results

engage -t (assumes Mixpanel key/secret set as environment variables)

Example output:

1138

Only output specific fields

engage -p '$email,$first_name'

Example output:

[
  { '$email': '[email protected]', '$first_name': 'Joakim' },
  { '$email': '[email protected]', '$first_name': 'Henrik' },
  { '$email': '[email protected]', '$first_name': 'Jonas' }
]

Output as CSV instead of JSON

engage -f csv

Example output:

Note: currently no special escaping or similar is implemented, so depending on values CSV may end up invalid.

Query using expression

This example returns people with $last_seen timestamp greater (later) than 24th of April (see the Mixpanel documentation for segmentation expressions).

engage -q 'properties["$last_seen"] > "2015-04-24T23:00:00"'

Relative date parsing

Often you need a query with a condition relative to today's date. In order to avoid having to generate the command-line parameters dynamically you can use a placeholder as [[DATE:<date string>]] which will be replaced by a correctly formatted date for the Mixpanel API. The <date string> may be formatted according to what Sugar Dates supports.

Examples:

engage -q 'properties["$last_seen"] > "[[DATE:yesterday]]"'

engage -q 'properties["$last_seen"] > "[[DATE:the beginning of last month]]"'

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].