PageSourceSearch

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

js grapplearts.com collected 2026-09-24 17:20:46 UTC 11,886 bytes, 363 lines download raw bytes

1// -- MoonRay Tracking Module
2
3// Settings
4var _mri = '',
5    _mrsess_ = '',
6    _mr_cid = '';
7var _mrd = document,
8    _mrl = _mrd.location.host + _mrd.location.pathname,
9    _mrct = new Date();
10var _mr_ex = 'expires=Sun, 18 Jan 2038 00:00:00 GMT';
11var _linktrack = '/trackThrough.php';
12var _mr_title = document.title;
13
14if (typeof(_mr_domain) === 'undefined') {
15    _mr_domain = 'tracking.ontraport.com';
16}
17
18var _mrl_internal_url = '';
19var _mrl_internal_domain = '';
20
21function mrSetupActual(url, domain) {
22    _mrl_internal_url = url;
23    _mrl_internal_domain = domain;
24}
25
26function mrtracking(mriOverRide) {
27    var _mrid = _mri,
28        _mrlv = '',
29        _mrref = '',
30        _mrafft_ = '',
31        _mraff_ = '',
32        _mrsess_ = '',
33        _mr_gets = '',
34        _mr_ctime = '',
35        _mrq = '';
36    
37    var _readParams = function() {
38        if (mriOverRide) {
39            _mrid = mriOverRide;
40        }
41        if (_mrl_internal_domain != '' && _mrl_internal_domain != document.location.hostname) {
42            // URL is not the same as the trackable one, and we were passed the original url so use that.
43            // This happens for wordpress-hosted ontrapages. Override the llc and l parameters.
44            _mrq = 'mid=' + _mrid + '&llc=' + _escapeT(_mrl_internal_url);
45            _mrl = _mrl_internal_url;
46        } else {
47            _mrq = 'mid=' + _mrid + '&llc=' + _escapeT(document.location.href);
48        }
49        _mrlv = gC('lastvisit');
50        _mrref = gC('ref_');
51        _mrafft_ = gC('afft_');
52        _mraff_ = gC('aff_');
53        _mrsess_ = gC('sess_');
54
55        _mr_gets = parseGetVars();
56        _mr_ctime = (_mrct.getTime() - _mrct.getMilliseconds()) / 1000;
57
58        if (!_mrsess_) {
59            _mrsess_ = genmrSess(20);
60            _mrq = _mrq + '&first_visit=1';
61            _mrd.cookie = 'sess_=' + _mrsess_ + ';' + _mr_ex + ';' + 'path=/';
62
63            _mrq = _mrq + '&referral_page=' + encodeURIComponent(document.referrer);
64            if (_mrq.length <= 200) {
65                _mrd.cookie = 'referral_page=' + document.referrer + ';' + _mr_ex + ';' + 'path=/';
66            } else {
67                _mrq = 'mid=' + _mrid + '&first_visit=1';
68            }
69
70        }
71
72        if (_mr_gets.mr_aff) {
73            _mrd.cookie = 'aff_' + '=' + _mr_gets.mr_aff + ';' + _mr_ex + ';' + 'path=/';
74            _mrq = _mrq + '&aff=' + _mr_gets.mr_aff;
75        } else if (_mr_gets.ref) {
76            _mrd.cookie = 'aff_' + '=' + _mr_gets.ref + ';' + _mr_ex + ';' + 'path=/';
77            _mrq = _mrq + '&aff=' + _mr_gets.ref;
78        } else if (_mr_gets.orid) {
79            _mrd.cookie = 'aff_' + '=' + _mr_gets.orid + ';' + _mr_ex + ';' + 'path=/';
80            _mrq = _mrq + '&aff=' + _mr_gets.orid;
81        }
82
83
84        var cookie_gets = ['opid', 'sid', 'oprid'];
85        for (var i = 0; i < cookie_gets.length; i++) {
86            if (_mr_gets[cookie_gets[i]]) {
87                _mrd.cookie = cookie_gets[i] + '=' + _mr_gets[cookie_gets[i]] + ';' + _mr_ex + ';' + 'path=/';
88                _mrq = _mrq + '&' + cookie_gets[i] + '=' + _mr_gets[cookie_gets[i]];
89            }
90        }
91
92        cookie_gets = ['utm_source', 'utm_medium', 'utm_term', 'utm_content', 'utm_campaign'];
93        var has_utm_gets = false;
94
95        for (var i = 0; i < cookie_gets.length; i++) {
96            if (_mr_gets[cookie_gets[i]]) {
97                has_utm_gets = true;
98                break;
99            }
100        }
101
102        if (has_utm_gets) {
103            for (var i = 0; i < cookie_gets.length; i++) {
104                var term = _mr_gets[cookie_gets[i]] || '';
105                _mrd.cookie = cookie_gets[i] + '=' + term + ';' + _mr_ex + ';' + 'path=/';
106                _mrq = _mrq + '&' + cookie_gets[i] + '=' + term;
107            }
108        }
109
110        _mrq = _mrq + '&s=' + _mrsess_ + '&l=' + _mrl + '&ti=' + _mr_title;
111        if (_mrref && !_mr_gets.sig) {
112            if ((_mrlv + 3600) < _mr_ctime) {
113                _mrq = _mrq + '&' + 't=' + _mrref;
114            } else {
115                _mrq = _mrq + '&' + 'r=1&t=' + _mrref;
116            }
117        }
118
119        if (_mr_cid = gC('contact_id')) {
120            _mrq = _mrq + '&c=' + _mr_cid;
121            _mrd.cookie = 'contact_id' + '=' + _mr_cid + ';' + _mr_ex + ';' + 'path=/';
122        }
123
124        if ((parseInt(_mrlv) + 3600) > _mr_ctime) {
125            _mr_vid = gC('vid');
126            if (_mr_vid) {
127                _mrq = _mrq + '&vid=' + _mr_vid;
128            }
129        } else {
130            _mrd.cookie = 'vid' + '=' + '' + ';' + _mr_ex + ';' + 'path=/';
131        }
132
133        if (_mr_gets.sig) {
134            _mrd.cookie = 'ref_' + '=' + _mr_gets.sig + ';' + _mr_ex + ';' + 'path=/';
135            if (_mrlv) {
136                if ((parseInt(_mrlv) + 3600) < _mr_ctime) {
137                    _mrq = _mrq + '&' + 't=' + _mr_gets.sig;
138                } else {
139                    _mrq = _mrq + '&' + 't=' + _mr_gets.sig + '&r=1';
140                }
141            } else {
142                _mrq = _mrq + '&' + 't=' + _mr_gets.sig;
143            }
144        }
145        // Set cookie for lastvisit to the current time
146        _mrd.cookie = 'lastvisit' + '=' + _mr_ctime + ';' + _mr_ex + ';' + 'path=/';
147
148        // Grab Google gclid and gid
149        if (window.ga) {
150            ga(function() {
151                var trackers = ga.getAll();
152                trackers.forEach(function(tracker) {
153                    _mrq = _mrq + '&gcid=' + tracker.get('clientId');
154                });
155            });
156        }
157    }
158
159    _readParams();
160
161    var sc = document.createElement('script');
162
163    var _onload = function() {
164        for (var i = 0; i < document.forms.length; i++) {
165            if (!document.forms[i].hasAttribute('data-opf-watch-submit') && document.forms[i].uid) {
166                if (document.forms[i].elements['unique' + document.forms[i].uid.value]) {
167                    _mrq = _mrq + '&forms[' + document.forms[i].uid.value + ']=' + document.forms[i].elements['unique' + document.forms[i].uid.value].value;
168                } else {
169                    _mrq = _mrq + '&forms[' + document.forms[i].uid.value + ']=0';
170                }
171            }
172        }
173        var meta = document.getElementsByTagName('meta');
174        var is_unique = '0';
175        for (var i = 0; i < meta.length; i++) {
176            if (meta[i].getAttribute('name') === 'unique') {
177                is_unique = meta[i].getAttribute('value');
178            }
179        }
180        _mrq = _mrq + '&is_unique=' + is_unique;
181        sc.src = 'https://' + _mr_domain + '/track.php?' + encodeURI(_mrq);
182        document.getElementsByTagName('head')[0].appendChild(sc);
183    };
184
185    var replaceHistoryFunction = function(type) {
186		var orig = history[type];
187		history[type + 'IsSet'] = true;
188		return function() {
189			var rv = orig.apply(this, arguments);
190			var e = new Event(type);
191			e.arguments = arguments;
192			window.dispatchEvent(e);
193			return rv;
194		};
195	};
196
197	if( !history['pushStateIsSet'] ) {
198		history.pushState = replaceHistoryFunction('pushState');
199
200		window.addEventListener('pushState', function(e) {
201			//without a delay, we will incorrectly track the page we're on, not the page we're going to.
202			setTimeout( function() {
203				_readParams();
204				_onload();
205			}, 0);
206		});
207	}
208
209
210    if (_mr_gets.gclid !== undefined && !gC('_op_gclid')) {
211        _mrd.cookie = '_op_gclid' + '=' + _mr_gets.gclid + ';' + _mr_ex + ';' + 'path=/';
212        _mrq = _mrq + '&gclid=' + _mr_gets.gclid;
213    }
214
215    //check if window.onload has already fired or not.
216    if (document.readyState === 'complete') {
217        _onload();
218    } else if (window.addEventListener) {
219        window.addEventListener('load', _onload, true);
220    } else {
221        window.attachEvent('onload', _onload);
222    }
223}
224
225function gC(c_name) {
226    var i, x, y, ARRcookies = document.cookie.split(';');
227    for (i = 0; i < ARRcookies.length; i++) {
228        x = ARRcookies[i].substr(0, ARRcookies[i].indexOf('='));
229        y = ARRcookies[i].substr(ARRcookies[i].indexOf('=') + 1);
230        x = x.replace(/^\s+|\s+$/g, '');
231        if (x == c_name) {
232            return decodeURI(y);
233        }
234    }
235}
236
237function parseGetVars() {
238    var encodedURI = window.location.search.substring(1).replace(/\+/g, ' ');
239
240    var qString = decodeURI(encodedURI);
241    var mr_dv = new Array();
242    var pairs = qString.split(/\&/);
243    var array_length = pairs.length;
244    if (array_length > 0) {
245        for (i = 0; i < array_length; i++) {
246            if (pairs[i]) {
247                var nameVal = pairs[i].split(/\=/);
248                mr_dv[nameVal[0]] = nameVal[1];
249            }
250        }
251    }
252    return mr_dv;
253}
254
255function genmrSess(length) {
256    session = '';
257    possible = '0123456789bcdfghjkmnpqrstvwxyz';
258
259    for (var i = 0; i < length; ++i) {
260        session += possible.substr(Math.floor(Math.random() * possible.length), 1);
261    }
262
263    return session;
264}
265
266function _escapeT(str) {
267    return encodeURI(str).replace(/\+/g, '%2B');
268}
269
270function _mrGetLinkTo(Item) {
271    if (Item.href != null) {
272        return Item.href;
273    } else if (Item.getAttribute('type') == 'submit') {
274        return (Item.form.action.indexOf('form_processor.php') != -1) ? 'moonrayform:' + Item.form.uid.value : Item.form.action;
275    } else {
276        return Item.attributes.getNamedItem('onclick').value;
277    }
278}
279
280function _sanitizeMrLink(link) {
281    if (link.substr(0, 7).toLowerCase() == 'http://') {
282        link = link.substr(7);
283    }
284    if (link.substr(0, 8).toLowerCase() == 'https://') {
285        link = link.substr(8);
286    }
287    if (link.substr(0, 4).toLowerCase() == 'www.') {
288        link = link.substr(4);
289    }
290    return link;
291}
292
293function _mrScanLinks() {
294    var Items = document.getElementsByTagName('*');
295    var LinkId, LinkAlias;
296    var linkCount = 0;
297    for (var i = 0; i < Items.length; i++) {
298        if ((Items[i].href == null || Items[i].getAttribute('href', 2) == '') && Items[i].onclick == null && Items[i].type != 'submit') {
299            continue;
300        }
301        linkCount++;
302        LinkId = -1;
303        LinkAlias = '';
304
305        if (Items[i].getAttribute('mtrack', 2)) {
306            LinkAlias = Items[i].getAttribute('mtrack', 2);
307        } else if (_mrTrackLinks[linkCount] != null) {
308            if (_sanitizeMrLink(_mrGetLinkTo(Items[i])) == _sanitizeMrLink(_mrTrackLinks[linkCount].link)) {
309                LinkId = _mrTrackLinks[linkCount].id;
310            }
311        }
312        if (LinkId != -1 || LinkAlias != '') {
313            if (Items[i].addEventListener) {
314                Items[i].addEventListener('click', _mrTrackLink, false);
315            } else {
316                Items[i].attachEvent('onclick', _mrTrackLink);
317            }
318            Items[i].linkTrackId = (LinkId != -1) ? LinkId : '';
319        }
320    }
321}
322
323function _mrTrackLink(event) {
324    if (event.target) {
325        var SrcObj = event.target;
326    } else {
327        var SrcObj = event.srcElement;
328    }
329    while (SrcObj.linkTrackId == null && !SrcObj.getAttribute('mtrack', 2)) {
330        SrcObj = SrcObj.parentNode;
331    }
332
333    var clickTrack = _mr_domain + _linktrack +
334        '?lid=' + _escapeT(SrcObj.linkTrackId) +
335        '&contact_id=' + _mr_cid +
336        '&session_id=' + _mrsess_ +
337        '&mri=' + _mri +
338        ((SrcObj.getAttribute('mtrack', 2)) ? '&mtrack=' + _escapeT(SrcObj.getAttribute('mtrack', 2)) + '&uri=' + _escapeT(document.location.href) : '');
339    var Ajaxor = _mrReturnXmlHttpObject();
340    Ajaxor.open('GET', clickTrack, true);
341    Ajaxor.send(null);
342}
343
344function _mrReturnXmlHttpObject() {
345    var xmlhttp = false;
346
347    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
348        try {
349            xmlhttp = new XMLHttpRequest();
350        } catch (e) {
351            xmlhttp = false;
352        }
353    }
354    if (!xmlhttp && window.createRequest) {
355        try {
356            xmlhttp = window.createRequest();
357        } catch (e) {
358            xmlhttp = false;
359        }
360    }
361    if (!xmlhttp) {}
362    return xmlhttp;
363}

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.