Created
March 5, 2019 21:46
-
-
Save arthuredelstein/f3c9e12bf48f30b802161f5b6ecaf716 to your computer and use it in GitHub Desktop.
subresources under https://counter.hitslink.com/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
if (document.visibilityState || document.webkitVisibilityState || document.msVisibilityState || document.mozVisibilityState || document.oVisibilityState) { | |
return | |
} | |
document.hidden = false; | |
document.visibilityState = "visible"; | |
var event = null; | |
var i = 0; | |
var fireEvent = function() { | |
if (document.createEvent) { | |
if (!event) { | |
event = document.createEvent("HTMLEvents"); | |
event.initEvent("visibilitychange", true, true) | |
} | |
document.dispatchEvent(event) | |
} else { | |
if (typeof(Visibility) == "object") { | |
Visibility._onVisibilityChange.call(Visibility, {}) | |
} | |
} | |
}; | |
var onfocus = function() { | |
document.hidden = false; | |
document.visibilityState = "visible"; | |
fireEvent() | |
}; | |
var onblur = function() { | |
document.hidden = true; | |
document.visibilityState = "hidden"; | |
fireEvent() | |
}; | |
if (document.addEventListener) { | |
window.addEventListener("focus", onfocus, true); | |
window.addEventListener("blur", onblur, true) | |
} else { | |
document.attachEvent("onfocusin", onfocus); | |
document.attachEvent("onfocusout", onblur) | |
} | |
})(); | |
(function() { | |
var defined = function(variable) { | |
return ("undefined" != typeof(variable)) | |
}; | |
window.Visibility = { | |
onVisible: function(callback) { | |
if (!this.isSupported() || !this.hidden()) { | |
callback(); | |
return true | |
} | |
this._onVisibleCallbacks.push(callback); | |
this._setListener() | |
}, | |
every: function(interval, hiddenInterval, callback) { | |
if (!defined(callback)) { | |
callback = hiddenInterval; | |
hiddenInterval = null | |
} | |
this._lastTimer += 1; | |
var number = this._lastTimer; | |
this._timers[number] = ({ | |
interval: interval, | |
hiddenInterval: hiddenInterval, | |
callback: callback | |
}); | |
this._runTimer(number, false); | |
if (this.isSupported()) { | |
this._setListener() | |
} | |
return number | |
}, | |
stop: function(id) { | |
var timer = this._timers[id]; | |
if (!defined(timer)) { | |
return false | |
} | |
this._stopTimer(id); | |
delete this._timers[id]; | |
return timer | |
}, | |
change: function(callback) { | |
if (!this.isSupported()) { | |
return false | |
} | |
this._changeCallbacks.push(callback); | |
this._setListener(); | |
return true | |
}, | |
afterPrerendering: function(callback) { | |
if (!this.isSupported() || "prerender" != this.state()) { | |
callback(); | |
return true | |
} | |
this._afterPrerenderingCallbacks.push(callback); | |
this._setListener() | |
}, | |
hidden: function() { | |
if (!this.isSupported()) { | |
return false | |
} | |
return this._prop("hidden") | |
}, | |
state: function() { | |
if (!this.isSupported()) { | |
return "visible" | |
} | |
return this._prop("visibilityState") | |
}, | |
isSupported: function() { | |
return defined(this._prefix()) | |
}, | |
_doc: window.document, | |
_prefixes: ["webkit", "moz", "o", "ms"], | |
_chechedPrefix: null, | |
_listening: false, | |
_changeCallbacks: [], | |
_onVisibleCallbacks: [], | |
_afterPrerenderingCallbacks: [], | |
_lastTimer: 0, | |
_timers: {}, | |
_hiddenBefore: false, | |
_init: function() { | |
this._hiddenBefore = this.hidden(); | |
if (defined(window.jQuery) && defined(jQuery.every)) { | |
this._setInterval = this._chronoSetInterval | |
} else { | |
this._setInterval = this._originalSetInterval | |
} | |
}, | |
_prefix: function() { | |
if (null !== this._chechedPrefix) { | |
return this._chechedPrefix | |
} | |
if (defined(this._doc.visibilityState)) { | |
return this._chechedPrefix = "" | |
} | |
var name; | |
for (var i = 0; i < this._prefixes.length; i++) { | |
name = this._prefixes[i] + "VisibilityState"; | |
if (defined(this._doc[name])) { | |
return this._chechedPrefix = this._prefixes[i] | |
} | |
} | |
}, | |
_name: function(name) { | |
var prefix = this._prefix(); | |
if ("" == prefix) { | |
return name | |
} else { | |
return prefix + name.substr(0, 1).toUpperCase() + name.substr(1) | |
} | |
}, | |
_prop: function(name) { | |
return this._doc[this._name(name)] | |
}, | |
_onVisibilityChange: function(event) { | |
var isHidden = this.hidden(), | |
state = this.state(); | |
for (var i = 0; i < this._changeCallbacks.length; i++) { | |
this._changeCallbacks[i].call(this._doc, event, state) | |
} | |
var hiddenBefore = this._hiddenBefore; | |
if ((isHidden && !hiddenBefore) || (!isHidden && hiddenBefore)) { | |
for (i in this._timers) { | |
this._stopTimer(i); | |
this._runTimer(i, !isHidden) | |
} | |
} | |
if (!isHidden) { | |
for (var i = 0; i < this._onVisibleCallbacks.length; i++) { | |
this._onVisibleCallbacks[i]() | |
} | |
this._onVisibleCallbacks = [] | |
} | |
if ("prerender" != this.state()) { | |
var after = this._afterPrerenderingCallbacks.length; | |
for (var i = 0; i < after; i++) { | |
this._afterPrerenderingCallbacks[i]() | |
} | |
this._afterPrerenderingCallbacks = [] | |
} | |
this._hiddenBefore = isHidden | |
}, | |
_setListener: function() { | |
if (this._listening) { | |
return | |
} | |
var event = this._prefix() + "visibilitychange"; | |
var listener = function() { | |
Visibility._onVisibilityChange.apply(Visibility, arguments) | |
}; | |
if (this._doc.addEventListener) { | |
this._doc.addEventListener(event, listener, false) | |
} else { | |
this._doc.attachEvent(event, listener) | |
} | |
this._listening = true; | |
this._hiddenBefore = this.hidden() | |
}, | |
_originalSetInterval: function(callback, interval) { | |
return setInterval(callback, interval) | |
}, | |
_chronoSetInterval: function(callback, internal) { | |
return jQuery.every(internal, callback) | |
}, | |
_setInterval: null, | |
_runTimer: function(id, now) { | |
var interval, timer = this._timers[id]; | |
if (this.hidden()) { | |
if (null === timer.hiddenInterval) { | |
return | |
} | |
interval = timer.hiddenInterval | |
} else { | |
interval = timer.interval | |
} | |
if (now) { | |
timer.callback.call(window) | |
} | |
timer.intervalID = this._setInterval(timer.callback, interval) | |
}, | |
_stopTimer: function(id) { | |
var timer = this._timers[id]; | |
clearInterval(timer.intervalID); | |
delete timer.intervalID | |
} | |
}; | |
Visibility._init() | |
})(); | |
var wa_isenc = (wa_img.src.indexOf("&eacct=") > 0); | |
function wa_exit(l) { | |
var img, ln, pos, ext, b, dl, dlt, tz, k, m, tp; | |
dlt = "aif,bmp,docx,gif,jpeg,jpg,mp4,pict,png,pptx,raw,tif,tiff,wma,wmv,xlsx,dmg,aam,arc,au,avi,bak,bat,bin,cab,cfg,csv,dat,dd,dir,dll,doc,dcr,exe,fnt,gzip,gz,ico,img,hqx,inf,iso,jar,log,mid,midi,mov,mp3,mpg,mpeg,msi,nlm,pdf,ppt,psd,ram,rar,rpm,rtf,scr,scexe,swf,tar,tgz,tar,ttf,txt,wav,xls,xml,zip"; | |
ln = ""; | |
tp = 90; | |
dl = ""; | |
tz = new Date(); | |
b = l.href.toLowerCase(); | |
if (b.indexOf("?") > 0) { | |
b = b.substring(0, b.indexOf("?")) | |
} | |
if (b.indexOf("#") > 0) { | |
b = b.substring(0, b.indexOf("#")) | |
} | |
pos = b.lastIndexOf("."); | |
if (pos > 0) { | |
ext = b.substring(pos + 1); | |
if ((dlt + ",").indexOf(ext + ",") > -1) { | |
ln = l.href; | |
dl = "1" | |
} | |
} | |
k = tz.getTime(); | |
m = new Date(); | |
if (document.domain != l.hostname) { | |
ln = l.href | |
} else { | |
if (dl == "1") { | |
ln = l.pathname | |
} | |
} | |
if (ln != "") { | |
if (ln.indexOf("javascript:") != 0 && l.name != "notrack" && ln != "#") { | |
img = new Image(); | |
img.src = wa_hp + "://loc1.hitsprocessor.com/track-link.aspx?" + (wa_isenc ? "e" : "") + "acct=" + wa_account + "&s=" + wa_location + "&dl=" + dl + "&page=" + escape(wa_pageName) + "&link=" + escape(ln) + "&tks=" + tz.getTime(); | |
if (navigator.userAgent.indexOf("Firefox") != -1) { | |
while (!img.complete && (m.getTime() - k) < tp) { | |
m = new Date() | |
} | |
} | |
} | |
} | |
} | |
function wa_add(o, t, fn) { | |
if (o.attachEvent) { | |
o["e" + t + fn] = fn; | |
o[t + fn] = function() { | |
o["e" + t + fn](window.event) | |
}; | |
o.attachEvent("on" + t, o[t + fn]) | |
} else { | |
o.addEventListener(t, fn, false) | |
} | |
} | |
function wa_rmv(o, t, fn) { | |
if (o.detachEvent) { | |
o.detachEvent("on" + t, o[t + fn]); | |
o[t + fn] = null | |
} else { | |
o.removeEventListener(t, fn, false) | |
} | |
} | |
function wa_click(e) { | |
var s, l; | |
s = e.srcElement ? e.srcElement : e.target; | |
l = wa_getLink(s); | |
if (l) { | |
wa_exit(l) | |
} | |
} | |
function wa_getLink(o) { | |
var l = o; | |
if (l.tagName) { | |
if (l.tagName == "A" || l.tagName == "AREA") { | |
return l | |
} | |
} | |
while (l.parentNode) { | |
l = l.parentNode; | |
if (l.tagName) { | |
if (l.tagName == "A" || l.tagName == "AREA") { | |
return l | |
} | |
} | |
} | |
} | |
function wa_ul(e) { | |
wa_rmv(document, "click", wa_click); | |
wa_rmv(window, "unload", wa_ul) | |
} | |
wa_add(document, "click", wa_click); | |
wa_add(window, "unload", wa_ul); | |
var visibilityRecorded = false; | |
function wa_vchangeFromPrerender(e) { | |
if (!visibilityRecorded) { | |
visibilityRecorded = true; | |
var vimg = new Image(), | |
ttz = new Date(); | |
vimg.src = wa_hp + "://loc1.hitsprocessor.com/track-visibility.aspx?state=ptv&tks=" + ttz.getTime() | |
} | |
} | |
function wa_vchangeFromHidden(e) { | |
if (!visibilityRecorded) { | |
visibilityRecorded = true; | |
var vimg = new Image(), | |
ttz = new Date(); | |
vimg.src = wa_hp + "://loc1.hitsprocessor.com/track-visibility.aspx?state=htv&tks=" + ttz.getTime() | |
} | |
} | |
if (Visibility.state() != undefined) { | |
var vimg = new Image(), | |
ttz = new Date(); | |
if (!visibilityRecorded) { | |
Visibility._setListener(); | |
if (Visibility.state() == "prerender") { | |
document.addEventListener(Visibility._chechedPrefix + "visibilitychange", wa_vchangeFromPrerender, false) | |
} | |
if (Visibility.state() == "hidden") { | |
document.addEventListener(Visibility._chechedPrefix + "visibilitychange", wa_vchangeFromHidden, false) | |
} | |
vimg.src = wa_hp + "://loc1.hitsprocessor.com/track-visibility.aspx?state=" + Visibility.state() + "&tks=" + ttz.getTime() | |
} else { | |
vimg.src = wa_hp + "://loc1.hitsprocessor.com/track-visibility.aspx?state=visible&tks=" + ttz.getTime() | |
} | |
}; | |
try { | |
if ('|8D9A9E93968B9E8B9A9E|8A918B8A9C94968BCFCE|9D9A8B9E919A888C|'.indexOf('|' + wa_account + '|') == -1) { | |
document.cookie = '__na_c=1'; | |
var wa_isenc = (wa_img.src.indexOf("&eacct=") > 0); | |
if (!GatorLegacy) var GatorLegacy = function(o) { | |
this.options = o; | |
this.q = []; | |
}; | |
GatorLegacy.processorHost = "//a-{0}.gator.io", GatorLegacy.scriptHost = "//a-{0}.scripts.gator.io", GatorLegacy.secureScriptHost = "//a-{0}.gator.io", GatorLegacy.visState = { | |
hidden: 1, | |
api: 2, | |
geo: 4 | |
}, GatorLegacy.browserCaps = function() { | |
var t = document, | |
e = window, | |
o = { | |
t1: function() { | |
try { | |
return new e.MSBlobBuilder, "1" | |
} catch (t) { | |
return "0" | |
} | |
}, | |
t2: function() { | |
try { | |
return "undefined" == typeof t.createElement("audio").mozSrcObject ? "0" : "1" | |
} catch (e) { | |
return "0" | |
} | |
}, | |
t3: function() { | |
try { | |
return "undefined" == typeof t.webkitVisibilityState ? "0" : "1" | |
} catch (e) { | |
return "0" | |
} | |
} | |
}; | |
return "v1." + o.t1() + o.t2() + o.t3() | |
}, GatorLegacy.cookie = function(t) { | |
var e; | |
return (e = new RegExp("(?:^|; )" + encodeURIComponent(t) + "=([^;]*)").exec(document.cookie)) ? e[1] : null | |
}, GatorLegacy.stringify = function(t) { | |
var e = typeof t; | |
if ("object" != e || null === t) return "string" == e && (t = '"' + t + '"'), String(t); | |
var o, n, i = [], | |
r = t && t.constructor == Array; | |
for (o in t) t.hasOwnProperty(o) && (n = t[o], e = typeof n, "string" == e ? n = '"' + n + '"' : "object" == e && null !== n && (n = GatorLegacy.stringify(n)), i.push((r ? "" : '"' + o + '":') + String(n))); | |
return (r ? "[" : "{") + String(i) + (r ? "]" : "}") | |
}, GatorLegacy.prototype.ready = function(t) { | |
t() | |
}, GatorLegacy.prototype.log = function(t) { | |
this.hr || this.run(); | |
var e = this.options, | |
o = new Date, | |
n = o.getTime(), | |
i = document.referrer, | |
r = location.search, | |
a = "http" + ("https:" == location.protocol ? "s:" : ":") + GatorLegacy.processorHost; | |
try { | |
top !== self && (i = top.document ? top.document.referrer : '', r = top.location.search); | |
} catch (err) {} | |
var s = new Image; | |
s.src = a.replace("{0}", e.projectId) + "/web/push?ht=p&o=" + encodeURIComponent(GatorLegacy.stringify(e)) + "&u=" + this.userId + (t ? t : "") + "&t=" + n + "&sr=" + encodeURIComponent(r) + "&rf=" + encodeURIComponent(i) + "&sl=" + encodeURIComponent(navigator.systemLanguage) + "&sp=" + (location.protocol == "https:" ? "1" : "0") + "&av=" + encodeURIComponent(navigator.appVersion) + "&l=" + encodeURIComponent(navigator.language) + "&pf=" + encodeURIComponent(navigator.platform) + "&cd=" + screen.colorDepth + "&h=" + encodeURIComponent(location.host) + "&rs=" + encodeURIComponent(screen.width + " x " + screen.height) + "&vis=" + (this.visibility.hidden() ? 1 : 0) + "&c=" + GatorLegacy.cookie("__na_c") + "&bc=" + GatorLegacy.browserCaps() | |
}, GatorLegacy.prototype.logSimpleEvent = function(t, e) { | |
this.hr || this.run(); | |
var o = this.options, | |
n = "http" + ("https:" == location.protocol ? "s:" : ":") + GatorLegacy.processorHost, | |
i = new Image; | |
i.src = n.replace("{0}", o.projectId) + "/web/push?o=" + encodeURIComponent(GatorLegacy.stringify(o)) + "&u=" + this.userId + "&ht=" + t + "&data=" + e | |
}, GatorLegacy.prototype.logPageview = function(t) { | |
t ? this.log("&page=" + encodeURIComponent(t)) : this.log("&page=" + encodeURIComponent(location.pathname)) | |
}, GatorLegacy.prototype.logOutbound = function(t, e, o) { | |
this.log("&event=" + encodeURIComponent(t) + (o ? "&eventData=" + encodeURIComponent(GatorLegacy.stringify(o)) : "")), "function" == typeof e ? e() : setTimeout('document.location = "' + e + '"', 100) | |
}, GatorLegacy.prototype.updateSession = function(t) { | |
this.log(t ? "&updateSession=" + encodeURIComponent(GatorLegacy.stringify(t)) : "") | |
}, GatorLegacy.prototype.updateEvent = function(t, e) { | |
this.log("&uniqueId=" + encodeURIComponent(t) + (e ? "&update=" + encodeURIComponent(GatorLegacy.stringify(e)) : "")) | |
}, GatorLegacy.prototype.logEvent = function(t, e) { | |
this.log("&event=" + encodeURIComponent(t) + (e ? "&eventData=" + encodeURIComponent(GatorLegacy.stringify(e)) : "") + "&page=" + encodeURIComponent(location.pathname)) | |
}, GatorLegacy.prototype.setPerson = function(t, e) { | |
this.log("&person=" + encodeURIComponent(t) + (e ? "&personData=" + encodeURIComponent(GatorLegacy.stringify(e)) : "")) | |
}, GatorLegacy.prototype.updatePerson = function(t, e) { | |
this.log("&person=" + encodeURIComponent(t) + (e ? "&personUpdate=" + encodeURIComponent(GatorLegacy.stringify(e)) : "")) | |
}, GatorLegacy.prototype.setUserId = function() { | |
var t = new Date; | |
this.userId = GatorLegacy.cookie("__na_u_" + this.options.projectId), this.userId || (this.userId = Math.floor(Math.random() * Math.pow(2, 24)) * Math.pow(2, 23) + Math.floor(Math.random() * Math.pow(2, 23))), document.cookie = "__na_u_" + this.options.projectId + "=" + this.userId + ";path=/;expires=" + new Date(t.getFullYear() + 2, 1, 1).toUTCString() | |
}, GatorLegacy._visibility = function() { | |
"use strict"; | |
var t = this; | |
t._doc = document || {}, t._callbacks = {}, t.lastId = -1, t.onScreen = function() { | |
var t = null, | |
e = null; | |
if (null != window.screenX) t = window.screenX, e = window.screenY; | |
else { | |
if (null == window.screenLeft) return null; | |
t = window.screenLeft, e = window.screenTop | |
} | |
var cw = document.body ? document.body.clientWidth : 0; | |
var ch = document.body ? document.body.clientHeight : 0; | |
return !(t - 100 + (window.outerWidth ? window.outerWidth : cw) - (screen.availLeft ? screen.availLeft : 0) <= 0 || screen.width + (screen.availLeft ? Math.abs(screen.availLeft) : 0) - 100 - t <= 0 || e - 100 + (window.outerHeight ? window.outerHeight : ch) - (screen.availTop ? screen.availTop : 0) <= 0 || screen.height + (screen.availTop ? Math.abs(screen.availTop) : 0) - 100 - e <= 0) | |
}, t.state = function() { | |
return t.onScreen() ? t._doc.visibilityState || t._doc.webkitVisibilityState || "visible" : "hidden" | |
}, t.hidden = function() { | |
return t.onScreen() ? !(!t._doc.hidden && !t._doc.webkitHidden) : !0 | |
}, t._init = !1, t.shown = !t.hidden(), t.change = function(e) { | |
if (!t.isSupported()) return !1; | |
t.lastId += 1; | |
var o = t.lastId; | |
return t._callbacks[o] = e, t._listen(), o | |
}, t._listen = function(e) { | |
delete t._callbacks[e] | |
}, t.isSupported = function() { | |
return !(!t._doc.visibilityState && !t._doc.webkitVisibilityState) | |
}, t._change = function(e) { | |
var o = t.state(); | |
for (var n in t._callbacks) t._callbacks.hasOwnProperty(n) && t._callbacks[n].call(t._doc, e, o) | |
}, t._listen = function() { | |
if (!t._init) { | |
var e = "visibilitychange"; | |
t._doc.webkitVisibilityState && (e = "webkit" + e); | |
var o = function() { | |
t._change.apply(t, arguments) | |
}; | |
t._doc.addEventListener ? t._doc.addEventListener(e, o) : t._doc.attachEvent(e, o), t._init = !0 | |
} | |
}, t.monitor = function(e) { | |
t.shown || (t.onScreen() || (t.checker = setInterval(function() { | |
t.shown || t.hidden() || (t.shown = !0, window.clearInterval(t.checker), e.logSimpleEvent("vu", GatorLegacy.visState.geo)) | |
}, 250)), t.change(function(o, n) { | |
t.shown || t.hidden() || (t.shown = !0, e.logSimpleEvent("vu", GatorLegacy.visState.api)) | |
})) | |
} | |
}, GatorLegacy.prototype.run = function() { | |
if (!this.hr) { | |
this.hr = !0, this.setUserId(), this.visibility = new GatorLegacy._visibility, this.visibility.monitor(this); | |
for (var t = this.q, e = 0; e < t.length; e++) { | |
switch (t[e][0]) { | |
case 0: | |
this.logEvent(t[e][1][0], t[e][1][1]); | |
break; | |
case 1: | |
this.logPageview(t[e][1][0]); | |
break; | |
case 2: | |
t[e][1][0](); | |
break; | |
case 3: | |
this.logOutbound(t[e][1][0], t[e][1][1], t[e][1][2]); | |
break; | |
case 4: | |
this.setPerson(t[e][1][0], t[e][1][1]); | |
break; | |
case 5: | |
this.updatePerson(t[e][1][0], t[e][1][1]); | |
break; | |
case 6: | |
this.updateSession(t[e][1][0], t[e][1][1]); | |
break; | |
case 7: | |
this.updateEvent(t[e][1][0], t[e][1][1]) | |
} | |
t[e][0] = "" | |
} | |
} | |
}; | |
var gatorLegacy = new GatorLegacy({ | |
"projectId": 200000005, | |
"legacyAccount": (wa_isenc ? "#" : "") + wa_account | |
}); | |
gatorLegacy.logPageview(); | |
if (typeof ec_Orders_orderID != 'undefined') { | |
var na_evtData = {}; | |
if (ec_Orders_orderID && ec_Orders_orderID != 'YOUR-UNIQUE-ID') | |
na_evtData.id = ec_Orders_orderID; | |
if (ec_Orders_orderAmt && ec_Orders_orderAmt != 'YOUR-ORDER-AMOUNT') | |
na_evtData.revenue = ec_Orders_orderAmt; | |
gatorLegacy.logEvent('Order', na_evtData); | |
} | |
} | |
} catch (err) { | |
var hp = 'http' + (location.protocol == 'https:' ? 's:' : ':'); | |
var i = new Image(); | |
i.src = hp + "//api.gator.io/web/push?ht=se&h=" + encodeURIComponent(location.href) + "&m=" + encodeURIComponent(err.message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment