mixpanel-cli
v1.0.3
Published
![deps](https://img.shields.io/david/fgribreau/mixpanel-cli.svg?style=flat) ![Version](https://img.shields.io/npm/v/mixpanel-cli.svg?style=flat) ![extra](https://img.shields.io/badge/actively%20maintained-yes-ff69b4.svg?style=flat) [![available-for-adviso
Downloads
5
Maintainers
Readme
mixpanel-cli - A command-line tool to query Mixpanel API
Shameless plug
- Charts, simple as a URL. No more server-side rendering pain, 1 url = 1 chart
- Looking for a free Redis GUI? Or for real-time alerting & monitoring for Redis?
Install (docker 🐳)
Use this approach if you don't know/want to setup your NodeJS environment, that's what containers are good for.
# add it (~/.bashrc or equivalent)
echo 'alias mixpanel="docker run -it --rm -e MIXPANEL_API_KEY=$(printenv MIXPANEL_API_KEY) fgribreau/mixpanel-cli:latest ./mixpanel"' >> ~/.bashrc
source ~/.bashrc
# run it!
mixpanel
Install (NodeJS)
npm i mixpanel-cli -S
Currently supported
$ mixpanel
Commands:
track Track an event
people.set Set properties on a user record
people.set_once Set properties on a user record, only if they do not yet exist
people.increment Increment/decrement numeric people analytics properties
people.append Append a value to a list-valued people analytics property
people.union Merge a given list with a list-valued people analytics property, excluding duplicate values
people.track_charge Record that you have charged the current user a certain amount of money
people.clear_charges Permanently clear all revenue report transactions from the current user's people analytics profile
people.delete_user Permanently deletes the current people analytics profile from Mixpanel (using the current distinct_id)
Options:
-h, --help Show help [boolean]
@FGRibreau - https://twitter.com/FGRibreau
Usage
First thing first, expose your mixpanel api key ("Project settings" > "Token") through an environment variable MIXPANEL_API_KEY
.
export MIXPANEL_API_KEY="your_api_key"
Track event
mixpanel track --distinct_id UNIQUE_USER_ID --event_name "User opened settings" --properties Country France Model "SM-T530"
Set property to user profile
mixpanel people.set --distinct_id UNIQUE_USER_ID --prop MyProperty --to ValueToSet
Add a property to a list of users (sequential)
echo "ID1\nID2" | xargs -I {ProfileID} mixpanel people.set --distinct_id {ProfileID} --prop MyProperty --to ValueToSet
Add a property to a list of users (parallel)
Same as above but does 10
requests in parallel (-P 10
)!
cat user_ids.txt | xargs -P 10 -I {ProfileID} mixpanel people.set --distinct_id {ProfileID} --prop MyProperty --to ValueToSet