Thanks to visit codestin.com
Credit goes to github.com

Skip to content

joyqi/tiny-mixpanel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');

About

A minium mixpanel library written in TypeScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published