PageSourceSearch

https://www.playinschool.com/wp-content/plugins/pilotpress/js/tracking.js?ver=6.0.2

js playinschool.com collected 2026-10-02 15:05:52 UTC 9,827 bytes, 315 lines download raw bytes

1// -- MoonRay Tracking Module
2
3// Settings
4var _mri = '', _mrq = '', _mrsess_ = '', _mr_cid = '';
5var _mrd = document, _mrl = _mrd.location.host + _mrd.location.pathname, _mrct = new Date();
6var _mr_ex = 'expires=Sun, 18 Jan 2038 00:00:00 GMT';
7var _linktrack = '/trackThrough.php';
8var _mr_title = document.title;
9
10if (typeof (_mr_domain) === 'undefined') {
11	_mr_domain = 'tracking.ontraport.com';
12}
13
14var _mrl_internal_url = '';
15var _mrl_internal_domain = '';
16function mrSetupActual(url, domain) {
17	_mrl_internal_url = url;
18	_mrl_internal_domain = domain;
19}
20
21function mrtracking(mriOverRide) {
22	var _mrid = _mri;
23	if (mriOverRide) {
24		_mrid = mriOverRide;
25	}
26	if (_mrl_internal_domain != '' && _mrl_internal_domain != document.location.hostname) {
27		// URL is not the same as the trackable one, and we were passed the original url so use that.
28		// This happens for wordpress-hosted ontrapages. Override the llc and l parameters.
29		var _mrq = 'mid=' + _mrid + '&llc=' + _escapeT(_mrl_internal_url);
30		_mrl = _mrl_internal_url;
31	} else {
32		var _mrq = 'mid=' + _mrid + '&llc=' + _escapeT(document.location.href);
33	}
34	var _mrlv = gC('lastvisit');
35	var _mrref = gC('ref_');
36	var _mrafft_ = gC('afft_');
37	var _mraff_ = gC('aff_');
38	var _mrsess_ = gC('sess_');
39
40	var _mr_gets = parseGetVars();
41	var _mr_ctime = (_mrct.getTime() - _mrct.getMilliseconds()) / 1000;
42
43	if (!_mrsess_) {
44		_mrsess_ = genmrSess(20);
45		_mrq = _mrq + '&first_visit=1';
46		_mrd.cookie = 'sess_=' + _mrsess_ + ';' + _mr_ex + ';' + 'path=/';
47
48		_mrq = _mrq + '&referral_page=' + encodeURIComponent(document.referrer);
49		if (_mrq.length <= 200) {
50			_mrd.cookie = 'referral_page=' + document.referrer + ';' + _mr_ex + ';' + 'path=/';
51		} else {
52			_mrq = 'mid=' + _mrid + '&first_visit=1';
53		}
54
55	}
56
57	if (_mr_gets.mr_aff) {
58		_mrd.cookie = 'aff_' + '=' + _mr_gets.mr_aff + ';' + _mr_ex + ';' + 'path=/';
59		_mrq = _mrq + '&aff=' + _mr_gets.mr_aff;
60	} else if (_mr_gets.ref) {
61		_mrd.cookie = 'aff_' + '=' + _mr_gets.ref + ';' + _mr_ex + ';' + 'path=/';
62		_mrq = _mrq + '&aff=' + _mr_gets.ref;
63	} else if (_mr_gets.orid) {
64		_mrd.cookie = 'aff_' + '=' + _mr_gets.orid + ';' + _mr_ex + ';' + 'path=/';
65		_mrq = _mrq + '&aff=' + _mr_gets.orid;
66	}
67
68	var cookie_gets = ['opid', 'sid', 'oprid'];
69	for (var i = 0; i < cookie_gets.length; i++) {
70		if (_mr_gets[cookie_gets[i]]) {
71			_mrd.cookie = cookie_gets[i] + '=' + _mr_gets[cookie_gets[i]] + ';' + _mr_ex + ';' + 'path=/';
72			_mrq = _mrq + '&' + cookie_gets[i] + '=' + _mr_gets[cookie_gets[i]];
73		}
74	}
75
76	cookie_gets = ['utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_campaign'];
77	var has_utm_gets = false;
78
79	for (var i = 0; i < cookie_gets.length; i++) {
80		if (_mr_gets[cookie_gets[i]]) {
81			has_utm_gets = true;
82			break;
83		}
84	}
85
86	if (has_utm_gets) {
87		for (var i = 0; i < cookie_gets.length; i++) {
88			var term = _mr_gets[cookie_gets[i]] || '';
89			_mrd.cookie = cookie_gets[i] + '=' + term + ';' + _mr_ex + ';' + 'path=/';
90			_mrq = _mrq + '&' + cookie_gets[i] + '=' + term;
91		}
92	}
93
94	_mrq = _mrq + '&s=' + _mrsess_ + '&l=' + _mrl + '&ti=' + _mr_title;
95	if (_mrref && !_mr_gets.sig) {
96		if ((_mrlv + 3600) < _mr_ctime) {
97			_mrq = _mrq + '&' + 't=' + _mrref;
98		} else {
99			_mrq = _mrq + '&' + 'r=1&t=' + _mrref;
100		}
101	}
102
103	if (_mr_cid = gC('contact_id')) {
104		_mrq = _mrq + '&c=' + _mr_cid;
105		_mrd.cookie = 'contact_id' + '=' + _mr_cid + ';' + _mr_ex + ';' + 'path=/';
106	}
107
108	if ((parseInt(_mrlv) + 3600) > _mr_ctime) {
109		_mr_vid = gC('vid');
110		if (_mr_vid) {
111			_mrq = _mrq + '&vid=' + _mr_vid;
112		}
113	} else {
114		_mrd.cookie = 'vid' + '=' + '' + ';' + _mr_ex + ';' + 'path=/';
115	}
116
117	if (_mr_gets.sig) {
118		_mrd.cookie = 'ref_' + '=' + _mr_gets.sig + ';' + _mr_ex + ';' + 'path=/';
119		if (_mrlv) {
120			if ((parseInt(_mrlv) + 3600) < _mr_ctime) {
121				_mrq = _mrq + '&' + 't=' + _mr_gets.sig;
122			} else {
123				_mrq = _mrq + '&' + 't=' + _mr_gets.sig + '&r=1';
124			}
125		} else {
126			_mrq = _mrq + '&' + 't=' + _mr_gets.sig;
127		}
128	}
129
130	var sc = document.createElement('script');
131
132	var _onload = function () {
133		for (var i = 0; i < document.forms.length; i++) {
134			if (!document.forms[i].hasAttribute('data-opf-watch-submit') && document.forms[i].uid) {
135				if (document.forms[i].elements['unique' + document.forms[i].uid.value]) {
136					_mrq = _mrq + '&forms[' + document.forms[i].uid.value + ']=' + document.forms[i].elements['unique' + document.forms[i].uid.value].value;
137				} else {
138					_mrq = _mrq + '&forms[' + document.forms[i].uid.value + ']=0';
139				}
140			}
141		}
142		var meta = document.getElementsByTagName('meta');
143		var is_unique = '0';
144		for (var i = 0; i < meta.length; i++) {
145			if (meta[i].getAttribute('name') === 'unique') {
146				is_unique = meta[i].getAttribute('value');
147			}
148		}
149		_mrq = _mrq + '&is_unique=' + is_unique;
150		sc.src = 'https://' + _mr_domain + '/track.php?' + encodeURI(_mrq);
151		document.getElementsByTagName('head')[0].appendChild(sc);
152	};
153
154	if (window.addEventListener) {
155		window.addEventListener('load', _onload, true);
156	} else {
157		window.attachEvent('onload', _onload);
158	}
159	// Set cookie for lastvisit to the current time
160	_mrd.cookie = 'lastvisit' + '=' + _mr_ctime + ';' + _mr_ex + ';' + 'path=/';
161}
162
163function gC(c_name) {
164	var i, x, y, ARRcookies = document.cookie.split(';');
165	for (i = 0; i < ARRcookies.length; i++) {
166		x = ARRcookies[i].substr(0, ARRcookies[i].indexOf('='));
167		y = ARRcookies[i].substr(ARRcookies[i].indexOf('=') + 1);
168		x = x.replace(/^\s+|\s+$/g, '');
169		if (x == c_name) {
170			return decodeURI(y);
171		}
172	}
173}
174
175function parseGetVars() {
176	// @hack replace + sign with space to deal with javascript awesomeness
177	/*
178		In 3.0/www/js/ontraport/common/common_functions.js function appendParamsToURL uses $.param to build the URL which is received here
179		$.param in jQuery encodes spaces as a + instead of %20
180		Google Analytics URL Builder uses a + instead of %20 for spaces.. so we need to be able to say that + is a space but
181		javascripts unescape and decodeURIComponent do not treat + as a space, it is not decoded at all
182	
183		if we were to decode it on the PHP side after this with an additional urldecode then real plus signs (which would be decoded here from %2b
184		to +) would become spaces
185	
186		further work is needed to build a standard query string parser that we use universally which would handle more cases.. but really there
187		is a lack of query string standards so this will probably be a constant mess if we don't control both the encoding and decoding. yay.
188	
189		http://unixpapa.com/js/querystring.html explains this wonderful problem and gives some solutions
190	
191		~ Scott Reed <[email protected]>
192	*/
193	var encodedURI = window.location.search.substring(1).replace(/\+/g, ' ');
194
195	var qString = decodeURI(encodedURI);
196	var mr_dv = new Array();
197	var pairs = qString.split(/\&/);
198	var array_length = pairs.length;
199	if (array_length > 0) {
200		for (i = 0; i < array_length; i++) {
201			if (pairs[i]) {
202				var nameVal = pairs[i].split(/\=/);
203				mr_dv[nameVal[0]] = nameVal[1];
204			}
205		}
206	}
207	return mr_dv;
208}
209
210function genmrSess(length) {
211	session = '';
212	possible = '0123456789bcdfghjkmnpqrstvwxyz';
213
214	for (var i = 0; i < length; ++i) {
215		session += possible.substr(Math.floor(Math.random() * possible.length), 1);
216	}
217
218	return session;
219}
220
221function _escapeT(str) {
222	return encodeURI(str).replace(/\+/g, '%2B');
223}
224function _mrGetLinkTo(Item) {
225	if (Item.href != null) {
226		return Item.href;
227	} else if (Item.getAttribute('type') == 'submit') {
228		return (Item.form.action.indexOf('form_processor.php') != -1) ? 'moonrayform:' + Item.form.uid.value : Item.form.action;
229	} else {
230		return Item.attributes.getNamedItem('onclick').value;
231	}
232}
233function _sanitizeMrLink(link) {
234	if (link.substr(0, 7).toLowerCase() == 'http://') {
235		link = link.substr(7);
236	}
237	if (link.substr(0, 8).toLowerCase() == 'https://') {
238		link = link.substr(8);
239	}
240	if (link.substr(0, 4).toLowerCase() == 'www.') {
241		link = link.substr(4);
242	}
243	return link;
244}
245
246function _mrScanLinks() {
247	var Items = document.getElementsByTagName('*');
248	var LinkId, LinkAlias;
249	var linkCount = 0;
250	for (var i = 0; i < Items.length; i++) {
251		if ((Items[i].href == null || Items[i].getAttribute('href', 2) == '') && Items[i].onclick == null && Items[i].type != 'submit') {
252			continue;
253		}
254		linkCount++;
255		LinkId = -1;
256		LinkAlias = '';
257
258		if (Items[i].getAttribute('mtrack', 2)) {
259			LinkAlias = Items[i].getAttribute('mtrack', 2);
260		} else if (_mrTrackLinks[linkCount] != null) {
261			if (_sanitizeMrLink(_mrGetLinkTo(Items[i])) == _sanitizeMrLink(_mrTrackLinks[linkCount].link)) {
262				LinkId = _mrTrackLinks[linkCount].id;
263			}
264		}
265		if (LinkId != -1 || LinkAlias != '') {
266			if (Items[i].addEventListener) {
267				Items[i].addEventListener('click', _mrTrackLink, false);
268			} else {
269				Items[i].attachEvent('onclick', _mrTrackLink);
270			}
271			Items[i].linkTrackId = (LinkId != -1) ? LinkId : '';
272		}
273	}
274}
275function _mrTrackLink(event) {
276	if (event.target) {
277		var SrcObj = event.target;
278	} else {
279		var SrcObj = event.srcElement;
280	}
281	while (SrcObj.linkTrackId == null && !SrcObj.getAttribute('mtrack', 2)) {
282		SrcObj = SrcObj.parentNode;
283	}
284
285	var clickTrack = _mr_domain + _linktrack +
286		'?lid=' + _escapeT(SrcObj.linkTrackId) +
287		'&contact_id=' + _mr_cid +
288		'&session_id=' + _mrsess_ +
289		'&mri=' + _mri +
290		((SrcObj.getAttribute('mtrack', 2)) ? '&mtrack=' + _escapeT(SrcObj.getAttribute('mtrack', 2)) + '&uri=' + _escapeT(document.location.href) : '');
291	var Ajaxor = _mrReturnXmlHttpObject();
292	Ajaxor.open('GET', clickTrack, true);
293	Ajaxor.send(null);
294}
295function _mrReturnXmlHttpObject() {
296	var xmlhttp = false;
297
298	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
299		try {
300			xmlhttp = new XMLHttpRequest();
301		} catch (e) {
302			xmlhttp = false;
303		}
304	}
305	if (!xmlhttp && window.createRequest) {
306		try {
307			xmlhttp = window.createRequest();
308		} catch (e) {
309			xmlhttp = false;
310		}
311	}
312	if (!xmlhttp) {
313	}
314	return xmlhttp;
315}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.