-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
31 lines (24 loc) · 1.49 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<head>
<script type="text/javascript">
!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=["collectTags","addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],c=0;c<s.length;c++){var o=s[c];e[t].prototype[o]=r(o)}var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.treasuredata.com/sdk/4.1/td.min.js";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(n,i)}}("Treasure",this);
var td = new Treasure({
database: 'weichen',
writeKey: '10452/125b8e3423673b23a020f3ceb48f54d89f07652b',
host: 'us01.records.in.treasuredata.com',
useNewJavaScriptEndpoint: true,
startInSignedMode: true,
useServerSideCookie: true
});
//td.setSignedMode()
//td.set('$global', 'td_global_id', 'td_global_id')
//td.trackPageview('pageviews');
//td.trackEvent('pageviews',{"source":"final"})
var successCallback = function (serverSideId) {
alert('success: ' + serverSideId)
};
var errorCallback = function (error) {
alert('fail: ' + error)
}
td.fetchServerCookie(successCallback, errorCallback)
</script>
</head>