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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
/*global Piwik getToken */
Piwik.addPlugin('testPlugin', {
/*
* called when tracker instantiated
* - function or string to be eval()'d
*/
run: function (params, registerHookCallback) {
registerHookCallback('test',
'{' +
'_isDefined : isDefined,' +
'_isFunction : isFunction,' +
'_isObject : isObject,' +
'_isString : isString,' +
'_isSiteHostName : isSiteHostName,' +
'_isSiteHostPath : isSiteHostPath,' +
'_getClassesRegExp : getClassesRegExp,' +
'_hasCookies : hasCookies,' +
'_getCookie : getCookie,' +
'_getCookieName : getCookieName,' +
'_setCookie : setCookie,' +
'_getLinkIfShouldBeProcessed : getLinkIfShouldBeProcessed,' +
'_encode : encodeWrapper,' +
'_decode : decodeWrapper,' +
'_urldecode : urldecode,' +
'_getLinkType : getLinkType,' +
'_beforeUnloadHandler : beforeUnloadHandler,' +
'_getProtocolScheme : getProtocolScheme,' +
'_getHostName : getHostName,' +
'_getUrlParameter : getUrlParameter,' +
'_addUrlParameter : addUrlParameter,' +
'_removeUrlParameter : removeUrlParameter,' +
'_getVisitorIdFromUrl : getVisitorIdFromUrl,' +
'_generateBrowserSpecificId : generateBrowserSpecificId,' +
'_makeCrossDomainDeviceId: makeCrossDomainDeviceId,' +
'_isSameCrossDomainDevice: isSameCrossDomainDevice,' +
'_replaceHrefForCrossDomainLink: replaceHrefForCrossDomainLink,' +
'_isLinkToDifferentDomainButSamePiwikWebsite: isLinkToDifferentDomainButSamePiwikWebsite,' +
'_arrayChunk : arrayChunk,' +
'_urlFixup : urlFixup,' +
'_domainFixup : domainFixup,' +
'_titleFixup : titleFixup,' +
'_sha1 : sha1,' +
'_utf8_encode : utf8_encode,' +
'_purify : purify,' +
'_resolveRelativeReference : resolveRelativeReference,' +
'_addEventListener : addEventListener,' +
'_prefixPropertyName : prefixPropertyName,' +
'_getPiwikUrlForOverlay : getPiwikUrlForOverlay, ' +
'_windowAlias : windowAlias, ' +
'_refreshConsentStatus : refreshConsentStatus, ' +
'_isInsideAnIframe : isInsideAnIframe' +
'}'
);
},
/*
* called when DOM ready
*/
load: function () { },
/*
* function called on trackPageView
* - returns URL components to be appended to tracker URL
*/
log: function () {
return '&testlog=' + encodeURIComponent('{"token":"' + getToken() + '"}');
},
/*
* function called on trackLink() or click event
* - returns URL components to be appended to tracker URL
*/
link: function () {
return '&testlink=' + encodeURIComponent('{"token":"' + getToken() + '"}');
},
/*
* function called on trackGoal()
* - returns URL components to be appended to tracker URL
*/
goal: function () {
return '&testgoal=' + encodeURIComponent('{"token":"' + getToken() + '"}');
},
/*
* called before page is unloaded
*/
unload: function () { }
});
|