tiny-mixpanel
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

tiny-mixpanel

What's this?

It's a minium mixpanel library written in TypeScript.

Why not mixpanel-browser?

Of course, you can use this official library. But it will make over 20kb extra sizes to a bundled js file. Moreover, considering the tracking system is widely used on every page, it will significantly increase the cost of your traffic.

So I rewrite the official embedding code by typescript. Then, instead of packaging it, it will load the whole library from the official CDN.

Install

npm i -S tiny-mixpanel

For TypeScript you should also

npm i -D @types/mixpanel

Usage

JavaScript

const { loadMixpanel } = require('tiny-mixpanel');

loadMixpanel();

mixpanel.init('xxxx-xxxxxxxxxxxxxxx');
mixpanel.track('event name');

TypeScript

import { loadMixpanel } from 'tiny-mixpanel';

loadMixpanel();

mixpanel.init('xxxx-xxxxxxxxxxxxxxx');
mixpanel.track('event name');

Package Sidebar

Install

npm i tiny-mixpanel

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

19.8 kB

Total Files

8

Last publish

Collaborators

  • joyqi