# mixpanel-cli **Repository Path**: mirrors_FGRibreau/mixpanel-cli ## Basic Information - **Project Name**: mixpanel-cli - **Description**: 🎩 mixpanel-cli - A complete CLI to query Mixpanel API - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-07-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### mixpanel-cli - A command-line tool to query Mixpanel API ![deps](https://img.shields.io/david/fgribreau/mixpanel-cli.svg?style=flat) ![Version](https://img.shields.io/npm/v/mixpanel-cli.svg?style=flat) [![Docker hub](https://img.shields.io/docker/pulls/fgribreau/mixpanel-cli.svg)](https://hub.docker.com/r/fgribreau/mixpanel-cli/) [![available-for-advisory](https://img.shields.io/badge/available%20for%20consulting%20advisory-yes-ff69b4.svg?)](http://bit.ly/2c7uFJq) ![extra](https://img.shields.io/badge/actively%20maintained-yes-ff69b4.svg) [![Twitter Follow](https://img.shields.io/twitter/follow/fgribreau.svg?style=flat)](https://twitter.com/FGRibreau) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/francois-guillaume-ribreau?utm_source=github&utm_medium=button&utm_term=francois-guillaume-ribreau&utm_campaign=github) [![Slack](https://img.shields.io/badge/Slack-Join%20our%20tech%20community-17202A?logo=slack)](https://join.slack.com/t/fgribreau/shared_invite/zt-edpjwt2t-Zh39mDUMNQ0QOr9qOj~jrg) ## Shameless plug - [**Charts, simple as a URL**. No more server-side rendering pain, 1 url = 1 chart](https://image-charts.com?gh_mixpanel_cli) - [Looking for a free **Redis GUI**?](http://redsmin.com?gh_mixpanel_cli) [Or for **real-time alerting** & monitoring for Redis?](http://redsmin.com)

mixpanel cli

## Install (docker 🐳) Use this approach if you don't know/want to setup your NodeJS environment, that's what containers are good for. ```shell # open ~/.bashrc (or equivalent) nano ~/.bashrc # edit it function mixpanel(){ docker run -it --rm -e MIXPANEL_API_KEY=$MIXPANEL_API_KEY fgribreau/mixpanel-cli:latest ./mixpanel $@ } # save it # source it source ~/.bashrc # run it! mixpanel # done! ``` ## 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`. ```shell export MIXPANEL_API_KEY="your_api_key" ``` ### Track event ```shell mixpanel track --distinct_id UNIQUE_USER_ID --event_name "User opened settings" --properties Country France Model "SM-T530" ``` ### Set property to user profile ```shell mixpanel people.set --distinct_id UNIQUE_USER_ID --prop MyProperty --to ValueToSet ``` ### Add a property to a list of users (sequential) ```shell 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`)! ```shell cat user_ids.txt | xargs -P 10 -I {ProfileID} mixpanel people.set --distinct_id {ProfileID} --prop MyProperty --to ValueToSet ``` ## Todo - [ ] More examples / better documentation (even if the CLI is completely documented) - [ ] Tests ## [Changelog](/CHANGELOG.md)