
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
mixpanel-node
Advanced tools
A type-safe TypeScript library provides stateless async functions to access Mixpanel API. These functions should be easy to test and easy to mock (in case you need to write unit test for your application).
It is created to replace https://github.com/mixpanel/mixpanel-node
, which is weakly-typed, complicated and buggy. To fix these problems, this project is written entirely in TypeScript, generates types directly from Mixpanel OpenAPI schema and stays close to the API.
npm install mixpanel-node
Sample usage:
import { ImportEventItem } from "mixpanel-node/types/ingestion/event";
import { configureMixpanelRegion, mixpanelIngestion } from "mixpanel-node";
configureMixpanelRegion("us");
console.log(mixpanelIngestion.profile);
async function main() {
const importEvent: ImportEventItem = {
event: "random-event",
properties: {
time: Date.now(),
distinct_id: "sample-distinct_id",
$insert_id: "sample-insert-id",
},
};
const strictResponse = await mixpanelIngestion.event.importEvents({
projectId: "sample-project-id",
auth: {
username: "username",
password: "password",
},
events: [importEvent],
strict: 1,
});
// type of strictResponse is StrictImportEventResponseData
console.log(strictResponse.code);
console.log(strictResponse.status);
console.log(strictResponse.num_records_imported);
const nonstrictResponse = await mixpanelIngestion.event.importEvents({
projectId: "sample-project-id",
auth: {
username: "username",
password: "password",
},
events: [importEvent],
});
// type of nonstrictResponse is 0 | 1
}
List of functions:
mixpanelIngestion
Types are imported from mixpanel-node/types
To configure mixpanel region:
import { configureMixpanelRegion, mixpanelIngestion } from "mixpanel-node";
configureMixpanelRegion("eu"); // value can either be `eu` or `us`
To configure axios, you can import mixpanelAxios
from mixpanel-node
import axiosRetry from "axios-retry";
import { mixpanelAxios } from "mixpanel-node";
axiosRetry(mixpanelAxios, { retries: 3 });
FAQs
Mixpanel API wrapper for Node.Js Typescript
The npm package mixpanel-node receives a total of 511 weekly downloads. As such, mixpanel-node popularity was classified as not popular.
We found that mixpanel-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.