Created
May 15, 2017 10:18
-
-
Save itochu0523/6620fd6f59cf96bed3059e208ecc921e to your computer and use it in GitHub Desktop.
To Shige-san
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 _tdOptions = { | |
initParams : { | |
host: 'in.treasuredata.com', | |
writeKey: 'YOUR_WRITE_KEY', | |
database: 'DATABASE_NAME' | |
}, | |
table : 'TABLE_NAME', | |
imToken : 'YOUR_IM_API_TOKEN', | |
customParam : {clid:{{uid}}} // ← 複数ある場合はカンマ区切りでこちらに足してください(by ito) | |
// overwriteParam : {td_title : "dummy"}, //基本項目を上書きしたい場合に利用 | |
// trackCrossDomain : true //defaultはfalse | |
}; | |
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}},s=["addRecord","set","trackEvent","trackPageview","trackClicks","ready"],a=0;a<s.length;a++){var c=s[a];e[t].prototype[c]=r(c)}var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.treasuredata.com/sdk/1.7.1/td.min.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(n,i)}}("Treasure",this); | |
!function(a,b,c,d,e){var f=function(){};f.prototype.init=function(c){this.customParam=c.customParam||{},this.overwriteParam=c.overwriteParam||{},this.success=c.successCallback||void 0,this.fail=c.errorCallback||void 0,this.table=c.table,this.trackClicks=c.trackClicks||!1,this.trackCrossDomain=c.trackCrossDomain||!1,this.imSyncUrl=c.imSyncUrl||"//sync.im-apps.net/imid/segment?token=",this.imToken=c.imToken,this.id="tdi"+Math.random().toString(36).substring(7);var e=new b[a](c.initParams);return this.trackClicks&&e.trackClicks(),this.trackCrossDomain&&e.set("$global","td_global_id","td_global_id"),e.set(this.table,this.customParam),this.td=e,b[d].cb[this.id]=this,this},f.prototype.boot=function(){this.createScript(this.buildImSyncUrl())},f.prototype.createScript=function(a){var b=c.createElement("script");b.type="text/javascript",b.async=!0,b.src=a;var d=c.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d)},f.prototype.buildImSyncUrl=function(){return this.imSyncUrl+this.imToken+"&callback="+encodeURIComponent(d+".cb."+this.id+".imCallback")},f.prototype.imCallback=function(a){a.imid&&this.td.set(this.table,{imid:a.imid}),a.segment_eids&&this.td.set(this.table,{segment_eids:a.segment_eids.join("|")}),this.td.trackEvent(this.table,this.overwriteParam,this.success,this.fail)},f.prototype.trackEvent=function(a,b,c){var d=this;return function(a,b,c){if("object"==typeof a)for(var e in a)a.hasOwnProperty(e)&&(d.overwriteParam[e]=a[e]);d.td.trackEvent(d.table,d.overwriteParam,b,c)}},b[d]={cb:{}};var g=(new f).init(e);b[d].trackEvent=g.trackEvent(),g.boot()}("Treasure",window,document,"TDIM",_tdOptions); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment