-
Notifications
You must be signed in to change notification settings - Fork 26
/
loader.js
50 lines (46 loc) · 1.16 KB
/
loader.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(function (n, c) {
if (c[n] === void 0) {
c[n] = function () {
c[n].clients.push(this)
this._init = [Array.prototype.slice.call(arguments)]
}
c[n].clients = []
var action = function (method) {
return function () {
this['_' + method] = this['_' + method] || []
this['_' + method].push(Array.prototype.slice.call(arguments))
return this
}
}
var methods = [
'addRecord',
'blockEvents',
'fetchServerCookie',
'fetchGlobalID',
'fetchUserSegments',
'resetUUID',
'ready',
'setSignedMode',
'setAnonymousMode',
'set',
'trackEvent',
'trackPageview',
'trackClicks',
'unblockEvents'
]
for (var i = 0; i < methods.length; i++) {
var method = methods[i]
c[n].prototype[method] = action(method)
}
var s = document.createElement('script')
s.type = 'text/javascript'
s.async = !0
s.src = (
document.location.protocol === 'https:'
? 'https:'
: 'http:'
) + '@URL'
var t = document.getElementsByTagName('script')[0]
t.parentNode.insertBefore(s, t)
}
})('@GLOBAL', this)