mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
Added Mixpanel definition.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
/// <reference path="mixpanel.d.ts" />
|
||||
var mixpanel = new Mixpanel();
|
||||
|
||||
function mixpanel_base()
|
||||
{
|
||||
mixpanel.init("new token", { your: "config" }, "library_name");
|
||||
|
||||
mixpanel.push(['register', { a: 'b' }]);
|
||||
|
||||
mixpanel.disable(['my_event']);
|
||||
|
||||
mixpanel.track("Registered", {"Gender": "Male", "Age": 21});
|
||||
|
||||
mixpanel.track_links("#nav", "Clicked Nav Link");
|
||||
|
||||
mixpanel.track_forms("#register", "Created Account");
|
||||
|
||||
mixpanel.register({device: 'android', version: '4.0.1'});
|
||||
|
||||
mixpanel.register_once({device: 'android', version: '4.0.1'});
|
||||
|
||||
mixpanel.unregister('device');
|
||||
|
||||
mixpanel.identify('234234sdfdsf');
|
||||
|
||||
mixpanel.get_distinct_id();
|
||||
|
||||
mixpanel.alias('w3erwfsdf', '234234sdfdsf');
|
||||
|
||||
mixpanel.set_config({test: true});
|
||||
|
||||
mixpanel.get_config();
|
||||
|
||||
mixpanel.get_property('device');
|
||||
}
|
||||
|
||||
function mixpanel_people()
|
||||
{
|
||||
mixpanel.people.set('gender', 'm');
|
||||
mixpanel.people.set({
|
||||
'Company': 'Acme',
|
||||
'Plan': 'Premium',
|
||||
'Upgrade date': new Date()
|
||||
});
|
||||
|
||||
mixpanel.people.set_once('First Login Date', new Date());
|
||||
mixpanel.people.set_once({
|
||||
'First Login Date': new Date(),
|
||||
'Starting Plan': 'Premium'
|
||||
});
|
||||
|
||||
mixpanel.people.increment('page_views', 1);
|
||||
mixpanel.people.increment('page_views');
|
||||
mixpanel.people.increment('credits_left', -1);
|
||||
mixpanel.people.increment({
|
||||
counter1: 1,
|
||||
counter2: 1
|
||||
});
|
||||
|
||||
mixpanel.people.append('pages_visited', 'homepage');
|
||||
mixpanel.people.append({
|
||||
list1: 'bob',
|
||||
list2: 123
|
||||
});
|
||||
|
||||
mixpanel.people.track_charge(50);
|
||||
mixpanel.people.track_charge(30.50, {'$time': new Date('jan 1 2012')});
|
||||
|
||||
mixpanel.people.clear_charges();
|
||||
|
||||
mixpanel.people.delete_user();
|
||||
}
|
||||
Vendored
+69
@@ -0,0 +1,69 @@
|
||||
// Type definitions for Mixpanel
|
||||
// Project: https://mixpanel.com/ (https://github.com/mixpanel/mixpanel-js)
|
||||
// Definitions by: Knut Eirik Leira Hjelle <https://github.com/hjellek/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare class Mixpanel
|
||||
{
|
||||
people:Mixpanel.People;
|
||||
|
||||
init(token:string, config:{[index:string]:any}, libraryName:string):Mixpanel;
|
||||
|
||||
push(item:any[]):void;
|
||||
|
||||
disable(events?:string[]):void;
|
||||
|
||||
track(eventName:string, params?:{[index:string]:any}, callback?:() => void):void;
|
||||
|
||||
track_links(querySelector:string, eventName:string, params?:{[index:string]:any}):void;
|
||||
|
||||
track_forms(querySelector:string, eventName:string, params?:{[index:string]:any}):void;
|
||||
|
||||
register(params:{[index:string]:any}, days?:number):void;
|
||||
|
||||
register_once(params:{[index:string]:any}, defaultValue?:string, days?:number):void;
|
||||
|
||||
unregister(propertyName:string):void;
|
||||
|
||||
identify(id:string):void;
|
||||
|
||||
get_distinct_id():string;
|
||||
|
||||
alias(alias:string, currentId?:string):void;
|
||||
|
||||
set_config(config:{[index:string]:any}):void;
|
||||
|
||||
get_config():{[index:string]:any};
|
||||
|
||||
get_property(propertyName:string):any;
|
||||
}
|
||||
|
||||
declare module Mixpanel
|
||||
{
|
||||
class People
|
||||
{
|
||||
set(keys:{[index:string]:any}, callback?:() => void):void;
|
||||
|
||||
set(key:string, value:any, callback?:() => void):void;
|
||||
|
||||
set_once(keys:{[index:string]:any}, callback?:() => void):void;
|
||||
|
||||
set_once(key:string, value:any, callback?:() => void):void;
|
||||
|
||||
increment(key:string):void;
|
||||
|
||||
increment(keys:{[index:string]:number}):void;
|
||||
|
||||
increment(key:string, value:number):void;
|
||||
|
||||
append(keys:{[index:string]:any}):void;
|
||||
|
||||
append(key:string, value:any):void;
|
||||
|
||||
track_charge(amount:number, params?:{[index:string]:any}, callback?:() => void):void;
|
||||
|
||||
clear_charges():void;
|
||||
|
||||
delete_user():void;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user