Created
June 2, 2015 17:54
-
-
Save 1ambda/c7c2edd6e2812935c046 to your computer and use it in GitHub Desktop.
Track.js
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
<script type="text/javascript"> | |
var isDev = true; | |
var token = "token"; | |
var rakeJSVersion = "1.3"; | |
(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 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); | |
function syrupOperation() { | |
var rake_lat = new (function(){ | |
this.rakeParamInfo = {}; | |
this.sendRakeData = function(obj) { | |
var sendParam = this.rakeParamInfo; | |
for(var param in obj) { | |
sendParam[param] = obj[param]; | |
} | |
var shuttle = new SyrupagentLogSentinelShuttle(); | |
for(var param in sendParam) { | |
var func =shuttle["set" + param.charAt(0).toUpperCase() + param.substr(1)]; | |
if(typeof func == "function") { | |
func(sendParam[param]); | |
} | |
} | |
setTimeout(function() { | |
mixpanel.track("", shuttle.get()); // 로그 정의에 맞게 입력 | |
}, 0); | |
}; | |
this.init = function(obj) { | |
for(var param in obj) { | |
this.rakeParamInfo[param] = obj[param]; | |
} | |
}; | |
this.formatDate = function(num){ | |
var fom = ""; | |
var iNum; | |
if(!isNaN(num)){ | |
iNum = Number(num); | |
if(iNum < 10){ | |
fom = "0" + iNum; | |
}else{ | |
fom = "" + iNum; | |
} | |
return fom; | |
} | |
return num; | |
}; | |
this.getLatencyId = function() { | |
var today = new Date(); | |
var to_year = today.getFullYear(); | |
var to_month = this.formatDate(today.getMonth() + 1); | |
var to_date = this.formatDate(today.getDate()); | |
var to_hours = this.formatDate(today.getHours()); | |
var to_minutes = this.formatDate(today.getMinutes()); | |
var to_seconds = this.formatDate(today.getSeconds()); | |
return [to_year, to_month, to_date, to_hours, to_minutes, to_seconds, today.getMilliseconds()].join(""); | |
} | |
})(); | |
var latency_timestamp = new Date(); | |
rake_lat.init({ | |
log_version : rakeJSVersion, | |
current_page : "/detail/brand_latency", | |
latency_flag : "Y", | |
latency_module_cnt : 7, | |
latency_time_stamp: rake_lat.getLatencyId() | |
}); | |
rake_lat.sendRakeData({latency_module_order : "0"}); | |
} | |
syrupOperation(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment