npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mixpanel-engage-post

v0.2.1

Published

Command-line tool to post data to the Mixpanel Engage API for People Data.

Downloads

5

Readme

Command-line tool to post data to the Mixpanel Engage API for People Data. Example usage are batch delete Mixpanel profiles, set people properties, remove properties, create new profiles, etc. See Mixpanel's HTTP API reference for the /engage endpoint for all possibilities of use.

Simply pipe in the data and the tool will automatically take care of updating it in batches to conform to Mixpanel's limit of 50 updates per API call.

This script is especially powerful in combination with mixpanel-engage-query that allow you to query the Mixpanel Engage API and export people profiles.

Installation

Install Node.js.

Type npm install --global mixpanel-engage-post

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

Setup

To run the script you must specify your Mixpanel API key, secret and your token either as parameters, as environment variables MIXPANEL_API_KEY, MIXPANEL_API_SECRET and MIXPANEL_API_TOKEN, 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
MIXPANEL_API_TOKEN=d8efyourmixpaneltokenbc49def928c

Usage

Typically you will put together a JSON-formatted file with an array of updates/deletions/changes/etc to perform on profiles. See the HTTP API reference for details.

Using mixpanel-engage-query you may query your existing profiles using a condition (e.g. $last_seen is older than a certain date or a special property is not set) and export a list. Protip: Use jq to process the result into a desired format.

Note: For your convenince the script will automatically add the $token property to each entry in the array.

When done, pipe this file to the script to have it perform the changes.

Example

Batch delete people profiles

cat profiles-to-delete.json | engagepost

Where profiles-to-delete.json is:

[
  {
    "$distinct_id": "12391",
    "$delete": ""
  },
  {
    "$distinct_id": "12408",
    "$delete": ""
  }
]

This will delete the profiles of users with id 12391 and 12408.

Example using mixpanel-engage-query and jq to produce file in same format:

engage. -q 'properties["$last_seen"] < "2015-04-24T22:00:00"' | jq '[.[] | { "$distinct_id", "$delete": "" }]'

This will result in a JSON file that when used with engagepost will delete the profiles of all users last seen prior to 24th of April, 2015.