Created
April 17, 2017 05:45
-
-
Save itochu0523/cdf4f35749462984209305f2fd3eed9d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
!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); | |
// Configure an instance for your database | |
var td = new Treasure({ | |
host: 'in.treasuredata.com', | |
writeKey: 'TD_API_KEY', | |
database: 'TD_DB_NAME' | |
}); | |
var successCallback = function(global_id) { | |
var el = document.createElement('img'); | |
el.src = (('https:' == document.location.protocol) ? 'https://' : 'http://') | |
+ 'bigmining.com/pixel/treasuredata2big.png?uid=' + global_id | |
+ '&account_id=8417'; | |
el.width=1;el.height=1;el.style.display='none'; | |
document.body.appendChild(el); | |
}; | |
var failureCallback = function(error) { | |
}; | |
var trackPageviewSuccessCallback = function(){ | |
td.fetchGlobalID(successCallback, failureCallback); | |
}; | |
td.set('$global', 'td_global_id', 'td_global_id'); | |
td.trackPageview('TD_TABLE_NAME',trackPageviewSuccessCallback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment