Welcome to mirror list, hosted at ThFree Co, Russian Federation.

piwiktest.js « javascript « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83d767295f974dbaaebcb9fd3d1862f5b5a47b4b (plain)
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
/*!
 * Piwik - Web Analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 * @version $Id$
 */

/*global Piwik getToken */

Piwik.addPlugin('testPlugin', {
	/*
	 * called when tracker instantiated
	 * - function or string to be eval()'d
	 */
	run: function (registerHookCallback) {
		registerHookCallback('test', '{ _isSiteHostName : isSiteHostName, _getClassesRegExp : getClassesRegExp, _hasCookies : hasCookies, _getCookie : getCookie, _setCookie : setCookie, _escape : escapeWrapper, _unescape : unescapeWrapper, _getLinkType : getLinkType, _beforeUnloadHandler : beforeUnloadHandler, _stringify : stringify }');
	},

	/*
	 * called when DOM ready
	 */
	load: function () { },

	/*
	 * function called on trackPageView
	 * - returns URL components to be appended to tracker URL
	 */
	log: function () {
		return '';
	},

	/*
	 * function called on trackLink() or click event
	 * - returns URL components to be appended to tracker URL
	 */
	click: function () {
		return '&data=' + encodeURIComponent('{"token":"' + getToken() + '"}');
	},

	/*
	 * function called on trackGoal()
	 * - returns URL components to be appended to tracker URL
	 */
	goal: function () {
		return '&data=' + encodeURIComponent('{"token":"' + getToken() + '"}');
	},

	/*
	 * called before page is unloaded
	 */
	unload: function () { }
});