Last active
August 29, 2015 14:25
-
-
Save 1ambda/49e9b0c76ffb5758368d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isDev = true; | |
var token = "your rake token"; | |
var rakeJSVersion = 1.5; | |
(function(e,b){var versionConnector=rakeJSVersion==""?"":"-"; if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;if(isDev){a.src='https://pg.rake.skplanet.com:8443/log/resources/js/rake-skp.test'+versionConnector+rakeJSVersion+'.min.js';}else{a.src='https://rake.skplanet.com:8443/log/resources/js/rake-skp'+versionConnector+rakeJSVersion+'.min.js';};f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable collect flush track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);mixpanel.init(token); | |
// collect, flush usage | |
mixpanel.collect(shuttle1.get()); | |
mixpanel.collect(shuttle2.get()); | |
mixpanel.flush(); | |
// invalid collect usage | |
shuttle.setDevice_model('GT-I9600'); | |
mixpanel.collect(shuttle.get()); | |
shuttle.setDevice_model('GT-I9700'); | |
mixpanel.collect(shuttle.get()); // DO NOT REUSE EXISINTG SHUTTLE! | |
mixpanel.flush(); | |
// always create shuttle when call `collect` | |
var shuttle1 = new Shuttle(); | |
shuttle.setDevice_model('GT-I9600'); | |
mixpanel.collect(shuttle1.get()); | |
var shuttle2 = new Shuttle(); | |
shuttle.setDevice_model('GT-I9700'); | |
mixpanel.collect(shuttle2.get()); | |
mixpanel.flush(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment