Last active
June 8, 2024 13:33
-
-
Save kevlened/fc89bd6a8cf22b36cc34ff9292e4c8bc to your computer and use it in GitHub Desktop.
Manually Deobfuscated Google Analytics js
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
/* | |
* | |
* This is currently a WIP | |
* Source originally pulled 3/28/2018 | |
* https://www.google-analytics.com/analytics.js | |
* | |
* Tools: | |
* 1) Google Chrome source formatter | |
* 2) VS Code right-click rename symbol | |
* | |
*/ | |
(function() { | |
var EnvTracker = function(a) { | |
this.flags = a || [] | |
}; | |
EnvTracker.prototype.set = function(flag) { | |
this.flags[flag] = true | |
} | |
; | |
EnvTracker.prototype.encode = function() { | |
var encodedArr = []; | |
for (var flag = 0; flag < this.flags.length; flag++) | |
this.flags[flag] && (encodedArr[Math.floor(flag / 6)] ^= 1 << flag % 6); | |
for (flag = 0; flag < encodedArr.length; flag++) | |
encodedArr[flag] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(encodedArr[flag] || 0); | |
return encodedArr.join("") + "~" | |
} | |
; | |
var envTracker = new EnvTracker; | |
function TrackEnvFlag(a) { | |
envTracker.set(a) | |
} | |
var getEncodedEnvTracker = function(a) { | |
a = Dd(a); | |
a = new EnvTracker(a); | |
var arrCopy = envTracker.flags.slice(); | |
for (var c = 0; c < a.flags.length; c++) | |
arrCopy[c] = arrCopy[c] || a.flags[c]; | |
return (new EnvTracker(arrCopy)).encode() | |
} | |
, Dd = function(a) { | |
a = a.get(_umEntry); | |
isArray(a) || (a = []); | |
return a | |
}; | |
var isFunction = function(a) { | |
return "function" == typeof a | |
} | |
, isArray = function(a) { | |
return "[object Array]" == Object.prototype.toString.call(Object(a)) | |
} | |
, isString = function(a) { | |
return undefined != a && -1 < (a.constructor + "").indexOf("String") | |
} | |
, arrayContains = function(a, b) { | |
return 0 == a.indexOf(b) | |
} | |
, formatGAStr = function(a) { | |
return a ? a.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "") : "" | |
} | |
, calcFingerprint = function() { | |
var fingerprint = WINDOW.navigator.userAgent + (DOCUMENT.cookie ? DOCUMENT.cookie : "") + (DOCUMENT.referrer ? DOCUMENT.referrer : ""); | |
for (var b = fingerprint.length, c = WINDOW.history.length; 0 < c; ) | |
fingerprint += c-- ^ b++; | |
return [getMathRandomInt() ^ La(fingerprint) & 2147483647, Math.round((new Date).getTime() / 1000)].join(".") | |
} | |
, createImgEl = function(a) { | |
var b = DOCUMENT.createElement("img"); | |
b.width = 1; | |
b.height = 1; | |
b.src = a; | |
return b | |
} | |
, noop = function() {} | |
, encodeURIComponent_ = function(str) { | |
if (encodeURIComponent instanceof Function) | |
return encodeURIComponent(str); | |
TrackEnvFlag(28); | |
return str | |
} | |
, addEventListener_ = function(el, type, listener, capture) { | |
try { | |
el.addEventListener ? el.addEventListener(type, listener, !!capture) : el.attachEvent && el.attachEvent("on" + type, listener) | |
} catch (e) { | |
TrackEnvFlag(27) | |
} | |
} | |
, isAllSpecialChars = /^[\w\-:/.?=&%!]+$/ | |
, addScriptEl = function(src, id, scriptEl, callback) { | |
src && (scriptEl ? ( | |
callback = "", | |
id && isAllSpecialChars.test(id) && (callback = ' id="' + id + '"'), | |
isAllSpecialChars.test(src) && DOCUMENT.write("<script" + callback + ' src="' + src + '">\x3c/script>') | |
) : ( | |
scriptEl = DOCUMENT.createElement("script"), | |
scriptEl.type = "text/javascript", | |
scriptEl.async = true, | |
scriptEl.src = src, | |
callback && (scriptEl.onload = callback), | |
id && (scriptEl.id = id), | |
src = DOCUMENT.getElementsByTagName("script")[0], | |
src.parentNode.insertBefore(scriptEl, src) | |
) | |
) | |
} | |
, isHttps = function() { | |
return "https:" == DOCUMENT.location.protocol | |
} | |
, getUrlParam = function(key, useHref) { | |
return parseUrlParam(DOCUMENT.location[useHref ? "href" : "search"], key) | |
} | |
, parseUrlParam = function(urlOrQuery, key) { | |
return (urlOrQuery = urlOrQuery.match("(?:&|#|\\?)" + encodeURIComponent_(key).replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") + "=([^&#]*)")) && 2 == urlOrQuery.length ? urlOrQuery[1] : "" | |
} | |
, returnSubdomainOrHostnameIfWWW = function() { | |
var a = "" + DOCUMENT.location.hostname; | |
return 0 == a.indexOf("www.") ? a.substring(4) : a | |
} | |
, de = function(a, b) { | |
var c = a.indexOf(b); | |
if (5 == c || 6 == c) | |
if (a = a.charAt(c + b.length), | |
"/" == a || "?" == a || "" == a || ":" == a) | |
return true; | |
return false | |
} | |
, ya = function(a, b) { | |
var c = DOCUMENT.referrer; | |
if (/^(https?|android-app):\/\//i.test(c)) { | |
if (a) | |
return c; | |
a = "//" + DOCUMENT.location.hostname; | |
if (!de(c, a)) | |
return b && (b = a.replace(/\./g, "-") + ".cdn.ampproject.org", | |
de(c, b)) ? undefined : c | |
} | |
} | |
, za = function(a, b) { | |
if (1 == b.length && null != b[0] && "object" === typeof b[0]) | |
return b[0]; | |
for (var c = {}, d = Math.min(a.length + 1, b.length), e = 0; e < d; e++) | |
if ("object" === typeof b[e]) { | |
for (var g in b[e]) | |
b[e].hasOwnProperty(g) && (c[g] = b[e][g]); | |
break | |
} else | |
e < a.length && (c[a[e]] = b[e]); | |
return c | |
}; | |
var IterableMap = function() { | |
this.keys = []; | |
this.values = {}; | |
this.m = {} | |
}; | |
IterableMap.prototype.set = function(key, val, shouldAddToMap) { | |
this.keys.push(key); | |
shouldAddToMap ? this.m[":" + key] = val : this.values[":" + key] = val | |
} | |
; | |
IterableMap.prototype.get = function(key) { | |
return this.m.hasOwnProperty(":" + key) ? this.m[":" + key] : this.values[":" + key] | |
} | |
; | |
IterableMap.prototype.map = function(fn) { | |
for (var k = 0; k < this.keys.length; k++) { | |
var key = this.keys[k] | |
, val = this.get(key); | |
val && fn(key, val) | |
} | |
} | |
; | |
var WINDOW = window | |
, DOCUMENT = document | |
, setTimeout_ = function(a, b) { | |
return setTimeout(a, b) | |
}; | |
var WINDOW = window | |
, DOCUMENT = document | |
, G = function(a) { | |
var b = WINDOW._gaUserPrefs; | |
if (b && b.ioo && b.ioo() || a && true === WINDOW["ga-disable-" + a]) | |
return true; | |
try { | |
var c = WINDOW.external; | |
if (c && c._gaUserPrefs && "oo" == c._gaUserPrefs) | |
return true | |
} catch (g) {} | |
a = []; | |
b = DOCUMENT.cookie.split(";"); | |
c = /^\s*AMP_TOKEN=\s*(.*?)\s*$/; | |
for (var d = 0; d < b.length; d++) { | |
var e = b[d].match(c); | |
e && a.push(e[1]) | |
} | |
for (b = 0; b < a.length; b++) | |
if ("$OPT_OUT" == decodeURIComponent(a[b])) | |
return true; | |
return false | |
}; | |
var parseCookies = function(key) { | |
var vals = [] | |
, cookieArray = DOCUMENT.cookie.split(";"); | |
var cookieRegEx = new RegExp("^\\s*" + key + "=\\s*(.*?)\\s*$"); | |
for (var c = 0; c < cookieArray.length; c++) { | |
var val = cookieArray[c].match(cookieRegEx); | |
val && vals.push(val[1]); | |
} | |
return vals | |
} | |
, zc = function(a, b, path, d, e, g) { | |
e = G(e) ? false : isDoubleclickDomain.test(DOCUMENT.location.hostname) || "/" == path && isGoogleDomain.test(d) ? false : true; | |
if (!e) | |
return false; | |
b && 1200 < b.length && (b = b.substring(0, 1200)); | |
var newCookie = a + "=" + b + "; path=" + path + "; "; | |
g && (newCookie += "expires=" + (new Date((new Date).getTime() + g)).toGMTString() + "; "); | |
d && "none" != d && (newCookie += "domain=" + d + ";"); | |
d = DOCUMENT.cookie; | |
DOCUMENT.cookie = newCookie; | |
if (!(d = d != DOCUMENT.cookie)) | |
a: { | |
a = parseCookies(a); | |
for (d = 0; d < a.length; d++) | |
if (b == a[d]) { | |
d = true; | |
break a | |
} | |
d = false | |
} | |
return d | |
} | |
, encodeURIComponentSlashes = function(a) { | |
return encodeURIComponent ? encodeURIComponent(a).replace(/\(/g, "%28").replace(/\)/g, "%29") : a | |
} | |
, isGoogleDomain = /^(www\.)?google(\.com?)?(\.[a-z]{2})?$/ | |
, isDoubleclickDomain = /(^|\.)doubleclick\.net$/i; | |
var oc, versionRegEx = /^.*Version\/?(\d+)[^\d].*$/i, ne = function() { | |
if (undefined !== WINDOW.__ga4__) | |
return WINDOW.__ga4__; | |
if (undefined === oc) { | |
var a = WINDOW.navigator.userAgent; | |
if (a) { | |
var b = a; | |
try { | |
b = decodeURIComponent(a) | |
} catch (c) {} | |
if (a = !(0 <= b.indexOf("Chrome")) && !(0 <= b.indexOf("CriOS")) && (0 <= b.indexOf("Safari/") || 0 <= b.indexOf("Safari,"))) | |
b = versionRegEx.exec(b), | |
a = 11 <= (b ? Number(b[1]) : -1); | |
oc = a | |
} else | |
oc = false | |
} | |
return oc | |
}; | |
var Fa, Ga, fb, Ab, isAmpProjectDomain = /^https?:\/\/[^/]*cdn\.ampproject\.org\//, Ub = [], ic = function() { | |
Z.D([noop]) | |
}, tc = function(a, b) { | |
var c = parseCookies("AMP_TOKEN"); | |
if (1 < c.length) | |
return TrackEnvFlag(55), | |
false; | |
c = decodeURIComponent(c[0] || ""); | |
if ("$OPT_OUT" == c || "$ERROR" == c || G(b)) | |
return TrackEnvFlag(62), | |
false; | |
if (!isAmpProjectDomain.test(DOCUMENT.referrer) && "$NOT_FOUND" == c) | |
return TrackEnvFlag(68), | |
false; | |
if (undefined !== Ab) | |
return TrackEnvFlag(56), | |
setTimeout_(function() { | |
a(Ab) | |
}, 0), | |
true; | |
if (Fa) | |
return Ub.push(a), | |
true; | |
if ("$RETRIEVING" == c) | |
return TrackEnvFlag(57), | |
setTimeout_(function() { | |
tc(a, b) | |
}, 1E4), | |
true; | |
Fa = true; | |
c && "$" != c[0] || (xc("$RETRIEVING", 3E4), | |
setTimeout(Mc, 3E4), | |
c = ""); | |
return Pc(c, b) ? (Ub.push(a), | |
true) : false | |
}, Pc = function(a, b, c) { | |
if (!window.JSON) | |
return TrackEnvFlag(58), | |
false; | |
var d = WINDOW.XMLHttpRequest; | |
if (!d) | |
return TrackEnvFlag(59), | |
false; | |
var e = new d; | |
if (!("withCredentials"in e)) | |
return TrackEnvFlag(60), | |
false; | |
e.open("POST", (c || "https://ampcid.google.com/v1/publisher:getClientId") + "?key=AIzaSyA65lEHUEizIsNtlbNo-l2K18dT680nsaM", true); | |
e.withCredentials = true; | |
e.setRequestHeader("Content-Type", "text/plain"); | |
e.onload = function() { | |
Fa = false; | |
if (4 == e.readyState) { | |
try { | |
200 != e.status && (TrackEnvFlag(61), | |
Qc("", "$ERROR", 3E4)); | |
var d = JSON.parse(e.responseText); | |
d.optOut ? (TrackEnvFlag(63), | |
Qc("", "$OPT_OUT", 31536E6)) : d.clientId ? Qc(d.clientId, d.securityToken, 31536E6) : !c && d.alternateUrl ? (Ga && clearTimeout(Ga), | |
Fa = true, | |
Pc(a, b, d.alternateUrl)) : (TrackEnvFlag(64), | |
Qc("", "$NOT_FOUND", 36E5)) | |
} catch (ca) { | |
TrackEnvFlag(65), | |
Qc("", "$ERROR", 3E4) | |
} | |
e = null | |
} | |
} | |
; | |
d = { | |
originScope: "AMP_ECID_GOOGLE" | |
}; | |
a && (d.securityToken = a); | |
e.send(JSON.stringify(d)); | |
Ga = setTimeout_(function() { | |
TrackEnvFlag(66); | |
Qc("", "$ERROR", 3E4) | |
}, 1E4); | |
return true | |
}, Mc = function() { | |
Fa = false | |
}, xc = function(a, b) { | |
if (undefined === fb) { | |
fb = ""; | |
for (var c = id(), d = 0; d < c.length; d++) { | |
var e = c[d]; | |
if (zc("AMP_TOKEN", encodeURIComponent(a), "/", e, "", b)) { | |
fb = e; | |
return | |
} | |
} | |
} | |
zc("AMP_TOKEN", encodeURIComponent(a), "/", fb, "", b) | |
}, Qc = function(a, b, c) { | |
Ga && clearTimeout(Ga); | |
b && xc(b, c); | |
Ab = a; | |
b = Ub; | |
Ub = []; | |
for (c = 0; c < b.length; c++) | |
b[c](a) | |
}; | |
var oe = function() { | |
return (Ba || isHttps() ? "https:" : "http:") + "//www.google-analytics.com" | |
} | |
, Da = function(a) { | |
this.name = "len"; | |
this.message = a + "-8192" | |
} | |
, ba = function(a, b, callback) { | |
callback = callback || noop; | |
if (2036 >= b.length) | |
createImgElForOriginAndQuery(a, b, callback); | |
else if (8192 >= b.length) | |
x(a, b, callback) || sendRequest(a, b, callback) || createImgElForOriginAndQuery(a, b, callback); | |
else | |
throw ge("len", b.length), | |
new Da(b.length); | |
} | |
, sendSimpleRequest = function(origin, query, c, callback) { | |
callback = callback || noop; | |
sendRequest(origin + "?" + query, "", callback, c) | |
} | |
, createImgElForOriginAndQuery = function(origin, query, callback) { | |
var imgEl = createImgEl(origin + "?" + query); | |
imgEl.onload = imgEl.onerror = function() { | |
imgEl.onload = null; | |
imgEl.onerror = null; | |
callback() | |
} | |
} | |
, sendRequest = function(url, b, callback, context) { | |
var XHR = WINDOW.XMLHttpRequest; | |
if (!XHR) | |
return false; | |
var xhr = new XHR; | |
if (!("withCredentials" in xhr)) | |
return false; | |
url = url.replace(/^http:/, "https:"); | |
xhr.open("POST", url, true); | |
xhr.withCredentials = true; | |
xhr.setRequestHeader("Content-Type", "text/plain"); | |
xhr.onreadystatechange = function() { | |
if (4 == xhr.readyState) { | |
if (context) | |
try { | |
var text = xhr.responseText; | |
if (1 > text.length) | |
ge("xhr", "ver", "0"), | |
callback(); | |
else if ("1" != text.charAt(0)) | |
ge("xhr", "ver", String(text.length)), | |
callback(); | |
else if (3 < context.count++) | |
ge("xhr", "tmr", "" + context.count), | |
callback(); | |
else if (1 == text.length) | |
callback(); | |
else { | |
var secondChar = text.charAt(1); | |
if ("d" == secondChar) | |
sendSimpleRequest("https://stats.g.doubleclick.net/j/collect", context.U, context, callback); | |
else if ("g" == secondChar) { | |
var gaAudUrl = "https://www.google.%/ads/ga-audiences".replace("%", "com"); | |
createImgElForOriginAndQuery(gaAudUrl, context.google, callback); | |
var remainingChars = text.substring(2); | |
if (remainingChars) | |
if (/^[a-z.]{1,6}$/.test(remainingChars)) { | |
var ha = "https://www.google.%/ads/ga-audiences".replace("%", remainingChars); | |
createImgElForOriginAndQuery(ha, context.google, noop) | |
} else | |
ge("tld", "bcc", remainingChars) | |
} else | |
ge("xhr", "brc", secondChar), | |
callback() | |
} | |
} catch (ue) { | |
ge("xhr", "rsp"), | |
callback() | |
} | |
else | |
callback(); | |
xhr = null | |
} | |
} | |
; | |
xhr.send(b); | |
return true | |
} | |
, x = function(a, b, c) { | |
return WINDOW.navigator.sendBeacon ? WINDOW.navigator.sendBeacon(a, b) ? (c(), | |
true) : false : false | |
} | |
, ge = function(a, b, c) { | |
1 <= 100 * Math.random() || G("?") || (a = ["t=error", "_e=" + a, "_v=j66", "sr=1"], | |
b && a.push("_f=" + b), | |
c && a.push("_m=" + encodeURIComponent_(c.substring(0, 100))), | |
a.push("aip=1"), | |
a.push("z=" + getMathRandomInt()), | |
createImgElForOriginAndQuery(oe() + "/collect", a.join("&"), noop)) | |
}; | |
var h = function(a) { | |
var b = WINDOW.gaData = WINDOW.gaData || {}; | |
return b[a] = b[a] || {} | |
}; | |
var Ha = function() { | |
this.M = [] | |
}; | |
Ha.prototype.add = function(a) { | |
this.M.push(a) | |
} | |
; | |
Ha.prototype.D = function(a) { | |
try { | |
for (var b = 0; b < this.M.length; b++) { | |
var c = a.get(this.M[b]); | |
c && isFunction(c) && c.call(WINDOW, a) | |
} | |
} catch (d) {} | |
b = a.get(hitCallbackEntry); | |
b != noop && isFunction(b) && (a.set(hitCallbackEntry, noop, true), | |
setTimeout(b, 10)) | |
} | |
; | |
function Ja(a) { | |
if (100 != a.get(sampleRateEntry) && La(P(a, clientIdEntry)) % 1E4 >= 100 * R(a, sampleRateEntry)) | |
throw "abort"; | |
} | |
function Ma(a) { | |
if (G(P(a, trackingIdEntry))) | |
throw "abort"; | |
} | |
function Oa() { | |
var a = DOCUMENT.location.protocol; | |
if ("http:" != a && "https:" != a) | |
throw "abort"; | |
} | |
function Pa(a) { | |
try { | |
WINDOW.navigator.sendBeacon ? TrackEnvFlag(42) : WINDOW.XMLHttpRequest && "withCredentials"in new WINDOW.XMLHttpRequest && TrackEnvFlag(40) | |
} catch (c) {} | |
a.set(usageEntry, getEncodedEnvTracker(a), true); | |
a.set(_sEntry, R(a, _sEntry) + 1); | |
var b = []; | |
iterMap.map(function(c, d) { | |
d.F && (c = a.get(c), | |
undefined != c && c != d.defaultValue && ("boolean" == typeof c && (c *= 1), | |
b.push(d.F + "=" + encodeURIComponent_("" + c)))) | |
}); | |
b.push("z=" + getCryptoRandomInt()); | |
a.set(hitPayloadEntry, b.join("&"), true) | |
} | |
function Sa(a) { | |
var origin = P(a, gd) || oe() + "/collect" | |
, context = a.get(qe) | |
, d = P(a, transportEntry); | |
!d && a.get(useBeaconEntry) && (d = "beacon"); | |
if (context) | |
sendSimpleRequest(origin, P(a, hitPayloadEntry), context, a.get(hitCallbackEntry)); | |
else if (d) { | |
context = d; | |
d = P(a, hitPayloadEntry); | |
var callback = a.get(hitCallbackEntry); | |
callback = callback || noop; | |
"image" == context ? createImgElForOriginAndQuery(origin, d, callback) : "xhr" == context && sendRequest(origin, d, callback) || "beacon" == context && x(origin, d, callback) || ba(origin, d, callback) | |
} else | |
ba(origin, P(a, hitPayloadEntry), a.get(hitCallbackEntry)); | |
origin = a.get(trackingIdEntry); | |
origin = h(origin); | |
context = origin.hitcount; | |
origin.hitcount = context ? context + 1 : 1; | |
origin = a.get(trackingIdEntry); | |
delete h(origin).pending_experiments; | |
a.set(hitCallbackEntry, noop, true) | |
} | |
function Hc(a) { | |
(WINDOW.gaData = WINDOW.gaData || {}).expId && a.set(expIdEntry, (WINDOW.gaData = WINDOW.gaData || {}).expId); | |
(WINDOW.gaData = WINDOW.gaData || {}).expVar && a.set(expVarEntry, (WINDOW.gaData = WINDOW.gaData || {}).expVar); | |
var b = a.get(trackingIdEntry); | |
if (b = h(b).pending_experiments) { | |
var c = []; | |
for (d in b) | |
b.hasOwnProperty(d) && b[d] && c.push(encodeURIComponent(d) + "." + encodeURIComponent(b[d])); | |
var d = c.join("!") | |
} else | |
d = undefined; | |
d && a.set(expEntry, d, true) | |
} | |
function cd() { | |
if (WINDOW.navigator && "preview" == WINDOW.navigator.loadPurpose) | |
throw "abort"; | |
} | |
function yd(a) { | |
var devIds = WINDOW.gaDevIds; | |
isArray(devIds) && 0 != devIds.length && a.set("&did", devIds.join(","), true) | |
} | |
function vb(a) { | |
if (!a.get(trackingIdEntry)) | |
throw "abort"; | |
} | |
;var getMathRandomInt = function() { | |
return Math.round(2147483647 * Math.random()) | |
} | |
, getCryptoRandomInt = function() { | |
try { | |
var a = new Uint32Array(1); | |
WINDOW.crypto.getRandomValues(a); | |
return a[0] & 2147483647 | |
} catch (b) { | |
return getMathRandomInt() | |
} | |
}; | |
function Ta(a) { | |
var b = R(a, _hcEntry); | |
500 <= b && TrackEnvFlag(15); | |
var c = P(a, hitTypeEntry); | |
if ("transaction" != c && "item" != c) { | |
c = R(a, _toEntry); | |
var d = (new Date).getTime() | |
, e = R(a, _tiEntry); | |
0 == e && a.set(_tiEntry, d); | |
e = Math.round(2 * (d - e) / 1000); | |
0 < e && (c = Math.min(c + e, 20), | |
a.set(_tiEntry, d)); | |
if (0 >= c) | |
throw "abort"; | |
a.set(_toEntry, --c) | |
} | |
a.set(_hcEntry, ++b) | |
} | |
;var DataHolder = function() { | |
this.data = new IterableMap | |
} | |
, iterMap = new IterableMap | |
, regExpPairs = []; | |
DataHolder.prototype.get = function(key) { | |
var b = $a(key) | |
, c = this.data.get(key); | |
b && undefined == c && (c = isFunction(b.defaultValue) ? b.defaultValue() : b.defaultValue); | |
return b && b.Z ? b.Z(this, key, c) : c | |
} | |
; | |
var P = function(a, b) { | |
a = a.get(b); | |
return undefined == a ? "" : "" + a | |
} | |
, R = function(a, b) { | |
a = a.get(b); | |
return undefined == a || "" === a ? 0 : 1 * a | |
}; | |
DataHolder.prototype.set = function(key, val, c) { | |
if (key) | |
if ("object" == typeof key) | |
for (var prop in key) | |
key.hasOwnProperty(prop) && ab(this, prop, key[prop], c); | |
else | |
ab(this, key, val, c) | |
} | |
; | |
var ab = function(a, key, val, d) { | |
if (undefined != val) | |
switch (key) { | |
case trackingIdEntry: | |
wb.test(val) | |
} | |
var e = $a(key); | |
e && e.o ? e.o(a, key, val, d) : a.data.set(key, val, d) | |
} | |
, Entry = function(name, key, defaultValue, callback1, callback2) { | |
this.name = name; | |
this.F = key; | |
this.Z = callback1; | |
this.o = callback2; | |
this.defaultValue = defaultValue | |
} | |
, $a = function(a) { | |
var b = iterMap.get(a); | |
if (!b) | |
for (var p = 0; p < regExpPairs.length; p++) { | |
var regExpPair = regExpPairs[p] | |
, e = regExpPair[0].exec(a); | |
if (e) { | |
b = regExpPair[1](e); | |
iterMap.set(b.name, b); | |
break | |
} | |
} | |
return b | |
} | |
, yc = function(a) { | |
var b; | |
iterMap.map(function(c, d) { | |
d.F == a && (b = d) | |
}); | |
return b && b.name | |
} | |
, createEntry = function(name, b, defaultValue, callback1, callback2) { | |
var entry = new Entry(name,b,defaultValue,callback1,callback2); | |
iterMap.set(entry.name, entry); | |
return entry.name | |
} | |
, addToRegExpPairs = function(key, fn) { | |
regExpPairs.push([new RegExp("^" + key + "$"), fn]) | |
} | |
, createBasicEntry = function(name, b, defaultValue) { | |
return createEntry(name, b, defaultValue, undefined, noop) | |
} | |
, noop = function() {}; | |
var gaFnName = isString(window.GoogleAnalyticsObject) && formatGAStr(window.GoogleAnalyticsObject) || "ga" | |
, utmaRegEx = /^(?:utma\.)?\d+\.\d+$/ | |
, ampIdRegEx = /^amp-[\w.-]{22,64}$/ | |
, Ba = false | |
, apiVersionEntry = createBasicEntry("apiVersion", "v") | |
, clientVersionEntry = createBasicEntry("clientVersion", "_v"); | |
createEntry("anonymizeIp", "aip"); | |
var adSenseIdEntry = createEntry("adSenseId", "a") | |
, hitTypeEntry = createEntry("hitType", "t") | |
, hitCallbackEntry = createEntry("hitCallback") | |
, hitPayloadEntry = createEntry("hitPayload"); | |
createEntry("nonInteraction", "ni"); | |
createEntry("currencyCode", "cu"); | |
createEntry("dataSource", "ds"); | |
var useBeaconEntry = createEntry("useBeacon", undefined, false) | |
, transportEntry = createEntry("transport"); | |
createEntry("sessionControl", "sc", ""); | |
createEntry("sessionGroup", "sg"); | |
createEntry("queueTime", "qt"); | |
var _sEntry = createEntry("_s", "_s"); | |
createEntry("screenName", "cd"); | |
var locationEntry = createEntry("location", "dl", "") | |
, referrerEntry = createEntry("referrer", "dr") | |
, pageEntry = createEntry("page", "dp", ""); | |
createEntry("hostname", "dh"); | |
var languageEntry = createEntry("language", "ul") | |
, encodingEntry = createEntry("encoding", "de"); | |
createEntry("title", "dt", function() { | |
return DOCUMENT.title || undefined | |
}); | |
addToRegExpPairs("contentGroup([0-9]+)", function(a) { | |
return new Entry(a[0],"cg" + a[1]) | |
}); | |
var screenColorsEntry = createEntry("screenColors", "sd") | |
, screenResolutionEntry = createEntry("screenResolution", "sr") | |
, viewportSizeEntry = createEntry("viewportSize", "vp") | |
, javaEnabledEntry = createEntry("javaEnabled", "je") | |
, flashVersionEntry = createEntry("flashVersion", "fl"); | |
createEntry("campaignId", "ci"); | |
createEntry("campaignName", "cn"); | |
createEntry("campaignSource", "cs"); | |
createEntry("campaignMedium", "cm"); | |
createEntry("campaignKeyword", "ck"); | |
createEntry("campaignContent", "cc"); | |
var eventCategoryEntry = createEntry("eventCategory", "ec") | |
, eventActionEntry = createEntry("eventAction", "ea") | |
, eventLabelEntry = createEntry("eventLabel", "el") | |
, eventValueEntry = createEntry("eventValue", "ev") | |
, socialNetworkEntry = createEntry("socialNetwork", "sn") | |
, socialActionEntry = createEntry("socialAction", "sa") | |
, socialTargetEntry = createEntry("socialTarget", "st") | |
, l1Entry = createEntry("l1", "plt") | |
, l2Entry = createEntry("l2", "pdt") | |
, l3Entry = createEntry("l3", "dns") | |
, l4Entry = createEntry("l4", "rrt") | |
, l5Entry = createEntry("l5", "srt") | |
, l6Entry = createEntry("l6", "tcp") | |
, l7Entry = createEntry("l7", "dit") | |
, l8Entry = createEntry("l8", "clt") | |
, timingCategoryEntry = createEntry("timingCategory", "utc") | |
, timingVarEntry = createEntry("timingVar", "utv") | |
, timingLabelEntry = createEntry("timingLabel", "utl") | |
, timingValueEntry = createEntry("timingValue", "utt"); | |
createEntry("appName", "an"); | |
createEntry("appVersion", "av", ""); | |
createEntry("appId", "aid", ""); | |
createEntry("appInstallerId", "aiid", ""); | |
createEntry("exDescription", "exd"); | |
createEntry("exFatal", "exf"); | |
var expIdEntry = createEntry("expId", "xid") | |
, expVarEntry = createEntry("expVar", "xvar") | |
, expEntry = createEntry("exp", "exp") | |
, _utmaEntry = createEntry("_utma", "_utma") | |
, _utmzEntry = createEntry("_utmz", "_utmz") | |
, _utmhtEntry = createEntry("_utmht", "_utmht") | |
, _hcEntry = createEntry("_hc", undefined, 0) | |
, _tiEntry = createEntry("_ti", undefined, 0) | |
, _toEntry = createEntry("_to", undefined, 20); | |
addToRegExpPairs("dimension([0-9]+)", function(a) { | |
return new Entry(a[0],"cd" + a[1]) | |
}); | |
addToRegExpPairs("metric([0-9]+)", function(a) { | |
return new Entry(a[0],"cm" + a[1]) | |
}); | |
createEntry("linkerParam", undefined, undefined, Bc, noop); | |
var usageEntry = createEntry("usage", "_u") | |
, _umEntry = createEntry("_um"); | |
createEntry("forceSSL", undefined, undefined, function() { | |
return Ba | |
}, function(a, b, c) { | |
TrackEnvFlag(34); | |
Ba = !!c | |
}); | |
var _j1Entry = createEntry("_j1", "jid") | |
, _j2Entry = createEntry("_j2", "gjid"); | |
addToRegExpPairs("\\&(.*)", function(a) { | |
var b = new Entry(a[0],a[1]) | |
, c = yc(a[0].substring(1)); | |
c && (b.Z = function(a) { | |
return a.get(c) | |
} | |
, | |
b.o = function(a, b, g, ca) { | |
a.set(c, g, ca) | |
} | |
, | |
b.F = undefined); | |
return b | |
}); | |
var _ootEntry = createBasicEntry("_oot") | |
, previewTaskEntry = createEntry("previewTask") | |
, Rb = createEntry("checkProtocolTask") | |
, md = createEntry("validationTask") | |
, Sb = createEntry("checkStorageTask") | |
, Uc = createEntry("historyImportTask") | |
, Tb = createEntry("samplerTask") | |
, Vb = createEntry("_rlt") | |
, Wb = createEntry("buildHitTask") | |
, Xb = createEntry("sendHitTask") | |
, Vc = createEntry("ceTask") | |
, zd = createEntry("devIdTask") | |
, Cd = createEntry("timingTask") | |
, Ld = createEntry("displayFeaturesTask") | |
, oa = createEntry("customTask") | |
, nameEntry = createBasicEntry("name") | |
, clientIdEntry = createBasicEntry("clientId", "cid") | |
, clientIdTimeEntry = createBasicEntry("clientIdTime") | |
, storedClientIdEntry = createBasicEntry("storedClientId") | |
, userIdEntry = createEntry("userId", "uid") | |
, trackingIdEntry = createBasicEntry("trackingId", "tid") | |
, cookieNameEntry = createBasicEntry("cookieName", undefined, "_ga") | |
, cookieDomainEntry = createBasicEntry("cookieDomain") | |
, cookiePathEntry = createBasicEntry("cookiePath", undefined, "/") | |
, cookieExpiresEntry = createBasicEntry("cookieExpires", undefined, 63072E3) | |
, cookieUpdateEntry = createBasicEntry("cookieUpdate", undefined, true) | |
, legacyCookieDomainEntry = createBasicEntry("legacyCookieDomain") | |
, legacyHistoryImportEntry = createBasicEntry("legacyHistoryImport", undefined, true) | |
, storageEntry = createBasicEntry("storage", undefined, "cookie") | |
, allowLinkerEntry = createBasicEntry("allowLinker", undefined, false) | |
, allowAnchorEntry = createBasicEntry("allowAnchor", undefined, true) | |
, sampleRateEntry = createBasicEntry("sampleRate", "sf", 100) | |
, siteSpeedSampleRateEntry = createBasicEntry("siteSpeedSampleRate", undefined, 1) | |
, alwaysSendReferrerEntry = createBasicEntry("alwaysSendReferrer", undefined, false) | |
, _gidEntry = createBasicEntry("_gid", "_gid") | |
, la = createBasicEntry("_gcn") | |
, Kd = createBasicEntry("useAmpClientId") | |
, ce = createBasicEntry("_gclid") | |
, fe = createBasicEntry("_gt") | |
, he = createBasicEntry("_ge", undefined, 7776E6) | |
, ie = createBasicEntry("_gclsrc") | |
, je = createBasicEntry("storeGac", undefined, true) | |
, gd = createEntry("transportUrl") | |
, Md = createEntry("_r", "_r") | |
, qe = createEntry("_dp"); | |
function X(a, b, c, d) { | |
b[a] = function() { | |
try { | |
return d && TrackEnvFlag(d), | |
c.apply(this, arguments) | |
} catch (e) { | |
throw ge("exc", a, e && e.name), | |
e; | |
} | |
} | |
} | |
;var Od = function(a, b) { | |
this.V = 1E4; | |
this.fa = a; | |
this.$ = false; | |
this.oa = b; | |
this.ea = 1 | |
} | |
, Ed = function(a, b) { | |
var c; | |
if (a.fa && a.$) | |
return 0; | |
a.$ = true; | |
if (b) { | |
if (a.oa && R(b, a.oa)) | |
return R(b, a.oa); | |
if (0 == b.get(siteSpeedSampleRateEntry)) | |
return 0 | |
} | |
if (0 == a.V) | |
return 0; | |
undefined === c && (c = getCryptoRandomInt()); | |
return 0 == c % a.V ? Math.floor(c / a.V) % a.ea + 1 : 0 | |
}; | |
function getFlashVersion() { | |
var a, b; | |
if ((b = (b = WINDOW.navigator) ? b.plugins : null) && b.length) | |
for (var c = 0; c < b.length && !a; c++) { | |
var d = b[c]; | |
-1 < d.name.indexOf("Shockwave Flash") && (a = d.description) | |
} | |
if (!a) | |
try { | |
var e = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); | |
a = e.GetVariable("$version") | |
} catch (g) {} | |
if (!a) | |
try { | |
e = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"), | |
a = "WIN 6,0,21,0", | |
e.AllowScriptAccess = "always", | |
a = e.GetVariable("$version") | |
} catch (g) {} | |
if (!a) | |
try { | |
e = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"), | |
a = e.GetVariable("$version") | |
} catch (g) {} | |
a && (e = a.match(/[\d]+/g)) && 3 <= e.length && (a = e[0] + "." + e[1] + " r" + e[2]); | |
return a || undefined | |
} | |
;var aa = function(a) { | |
var b = Math.min(R(a, siteSpeedSampleRateEntry), 100); | |
return La(P(a, clientIdEntry)) % 100 >= b ? false : true | |
} | |
, gc = function(a) { | |
var b = {}; | |
if (Ec(b) || Fc(b)) { | |
var c = b[l1Entry]; | |
undefined == c || Infinity == c || isNaN(c) || (0 < c ? (Y(b, l3Entry), | |
Y(b, l6Entry), | |
Y(b, l5Entry), | |
Y(b, l2Entry), | |
Y(b, l4Entry), | |
Y(b, l7Entry), | |
Y(b, l8Entry), | |
setTimeout_(function() { | |
a(b) | |
}, 10)) : addEventListener_(WINDOW, "load", function() { | |
gc(a) | |
}, false)) | |
} | |
} | |
, Ec = function(a) { | |
var performanceData = WINDOW.performance || WINDOW.webkitPerformance; | |
performanceData = performanceData && performanceData.timing; | |
if (!performanceData) | |
return false; | |
var c = performanceData.navigationStart; | |
if (0 == c) | |
return false; | |
a[l1Entry] = performanceData.loadEventStart - c; | |
a[l3Entry] = performanceData.domainLookupEnd - performanceData.domainLookupStart; | |
a[l6Entry] = performanceData.connectEnd - performanceData.connectStart; | |
a[l5Entry] = performanceData.responseStart - performanceData.requestStart; | |
a[l2Entry] = performanceData.responseEnd - performanceData.responseStart; | |
a[l4Entry] = performanceData.fetchStart - c; | |
a[l7Entry] = performanceData.domInteractive - c; | |
a[l8Entry] = performanceData.domContentLoadedEventStart - c; | |
return true | |
} | |
, Fc = function(a) { | |
if (WINDOW.top != WINDOW) | |
return false; | |
var IE_EXTERNAL = WINDOW.external | |
, c = IE_EXTERNAL && IE_EXTERNAL.onloadT; | |
IE_EXTERNAL && !IE_EXTERNAL.isValidLoadTime && (c = undefined); | |
2147483648 < c && (c = undefined); | |
0 < c && IE_EXTERNAL.setPageReadyTime(); | |
if (undefined == c) | |
return false; | |
a[l1Entry] = c; | |
return true | |
} | |
, Y = function(a, b) { | |
var c = a[b]; | |
if (isNaN(c) || Infinity == c || 0 > c) | |
a[b] = undefined | |
} | |
, Fd = function(a) { | |
return function(b) { | |
if ("pageview" == b.get(hitTypeEntry) && !a.I) { | |
a.I = true; | |
var c = aa(b) | |
, d = 0 < parseUrlParam(b.get(locationEntry), "gclid").length; | |
(c || d) && gc(function(b) { | |
c && a.send("timing", b); | |
d && a.send("adtiming", b) | |
}) | |
} | |
} | |
}; | |
var hc = false | |
, mc = function(a) { | |
if ("cookie" == P(a, storageEntry)) { | |
if (a.get(cookieUpdateEntry) || P(a, storedClientIdEntry) != P(a, clientIdEntry)) { | |
var b = 1000 * R(a, cookieExpiresEntry); | |
ma(a, clientIdEntry, cookieNameEntry, b) | |
} | |
ma(a, _gidEntry, la, 864E5); | |
if (a.get(je)) { | |
var c = a.get(ce); | |
if (c) { | |
var d = Math.min(R(a, he), 1000 * R(a, cookieExpiresEntry)); | |
d = Math.min(d, 1000 * R(a, fe) + d - (new Date).getTime()); | |
a.data.set(he, d); | |
var e = a.get(fe) | |
, g = a.get(ie); | |
b = kc(P(a, cookiePathEntry)); | |
var ca = lc(P(a, cookieDomainEntry)); | |
a = P(a, trackingIdEntry); | |
g && "aw.ds" != g || (c = ["1", e, encodeURIComponentSlashes(c)].join("."), | |
0 < d && zc("_gac_" + encodeURIComponentSlashes(a), c, b, ca, a, d)); | |
le({}) | |
} | |
} else | |
TrackEnvFlag(75) | |
} | |
} | |
, ma = function(a, b, c, d) { | |
var e = nd(a, b); | |
if (e) { | |
c = P(a, c); | |
var g = kc(P(a, cookiePathEntry)) | |
, ca = lc(P(a, cookieDomainEntry)) | |
, l = P(a, trackingIdEntry); | |
if ("auto" != ca) | |
zc(c, e, g, ca, l, d) && (hc = true); | |
else { | |
TrackEnvFlag(32); | |
for (var k = id(), w = 0; w < k.length; w++) | |
if (ca = k[w], | |
a.data.set(cookieDomainEntry, ca), | |
e = nd(a, b), | |
zc(c, e, g, ca, l, d)) { | |
hc = true; | |
return | |
} | |
a.data.set(cookieDomainEntry, "auto") | |
} | |
} | |
} | |
, nc = function(a) { | |
if ("cookie" == P(a, storageEntry) && !hc && (mc(a), | |
!hc)) | |
throw "abort"; | |
} | |
, Yc = function(a) { | |
if (a.get(legacyHistoryImportEntry)) { | |
var b = P(a, cookieDomainEntry) | |
, c = P(a, legacyCookieDomainEntry) || returnSubdomainOrHostnameIfWWW() | |
, d = Xc("__utma", c, b); | |
d && (TrackEnvFlag(19), | |
a.set(_utmhtEntry, (new Date).getTime(), true), | |
a.set(_utmaEntry, d.R), | |
(b = Xc("__utmz", c, b)) && d.hash == b.hash && a.set(_utmzEntry, b.R)) | |
} | |
} | |
, nd = function(a, b) { | |
b = encodeURIComponentSlashes(P(a, b)); | |
var c = lc(P(a, cookieDomainEntry)).split(".").length; | |
a = jc(P(a, cookiePathEntry)); | |
1 < a && (c += "-" + a); | |
return b ? ["GA1", c, b].join(".") : "" | |
} | |
, Xd = function(a, b) { | |
return na(b, P(a, cookieDomainEntry), P(a, cookiePathEntry)) | |
} | |
, na = function(a, b, c) { | |
if (!a || 1 > a.length) | |
TrackEnvFlag(12); | |
else { | |
for (var d = [], e = 0; e < a.length; e++) { | |
var g = a[e]; | |
var ca = g.split("."); | |
var l = ca.shift(); | |
("GA1" == l || "1" == l) && 1 < ca.length ? (g = ca.shift().split("-"), | |
1 == g.length && (g[1] = "1"), | |
g[0] *= 1, | |
g[1] *= 1, | |
ca = { | |
H: g, | |
s: ca.join(".") | |
}) : ca = ampIdRegEx.test(g) ? { | |
H: [0, 0], | |
s: g | |
} : undefined; | |
ca && d.push(ca) | |
} | |
if (1 == d.length) | |
return TrackEnvFlag(13), | |
d[0].s; | |
if (0 == d.length) | |
TrackEnvFlag(12); | |
else { | |
TrackEnvFlag(14); | |
d = Gc(d, lc(b).split(".").length, 0); | |
if (1 == d.length) | |
return d[0].s; | |
d = Gc(d, jc(c), 1); | |
1 < d.length && TrackEnvFlag(41); | |
return d[0] && d[0].s | |
} | |
} | |
} | |
, Gc = function(a, b, c) { | |
for (var d = [], e = [], g, ca = 0; ca < a.length; ca++) { | |
var l = a[ca]; | |
l.H[c] == b ? d.push(l) : undefined == g || l.H[c] < g ? (e = [l], | |
g = l.H[c]) : l.H[c] == g && e.push(l) | |
} | |
return 0 < d.length ? d : e | |
} | |
, lc = function(a) { | |
return 0 == a.indexOf(".") ? a.substr(1) : a | |
} | |
, id = function() { | |
var a = [] | |
, b = returnSubdomainOrHostnameIfWWW().split("."); | |
if (4 == b.length) { | |
var c = b[b.length - 1]; | |
if (parseInt(c, 10) == c) | |
return ["none"] | |
} | |
for (c = b.length - 2; 0 <= c; c--) | |
a.push(b.slice(c).join(".")); | |
a.push("none"); | |
return a | |
} | |
, kc = function(a) { | |
if (!a) | |
return "/"; | |
1 < a.length && a.lastIndexOf("/") == a.length - 1 && (a = a.substr(0, a.length - 1)); | |
0 != a.indexOf("/") && (a = "/" + a); | |
return a | |
} | |
, jc = function(a) { | |
a = kc(a); | |
return "/" == a ? 1 : a.split("/").length | |
} | |
, le = function(a) { | |
a.ta && TrackEnvFlag(77); | |
a.na && TrackEnvFlag(74); | |
a.pa && TrackEnvFlag(73); | |
a.ua && TrackEnvFlag(69) | |
}; | |
function Xc(a, b, c) { | |
"none" == b && (b = ""); | |
var d = [] | |
, e = parseCookies(a); | |
a = "__utma" == a ? 6 : 2; | |
for (var g = 0; g < e.length; g++) { | |
var ca = ("" + e[g]).split("."); | |
ca.length >= a && d.push({ | |
hash: ca[0], | |
R: e[g], | |
O: ca | |
}) | |
} | |
if (0 != d.length) | |
return 1 == d.length ? d[0] : Zc(b, d) || Zc(c, d) || Zc(null, d) || d[0] | |
} | |
function Zc(a, b) { | |
if (null == a) | |
var c = a = 1; | |
else | |
c = La(a), | |
a = La(contains(a, ".") ? a.substring(1) : "." + a); | |
for (var d = 0; d < b.length; d++) | |
if (b[d].hash == c || b[d].hash == a) | |
return b[d] | |
} | |
;var isProtocol = new RegExp(/^https?:\/\/([^\/:]+)/) | |
, pd = /(.*)([?&#])(?:_ga=[^&#]*)(?:&?)(.*)/ | |
, me = /(.*)([?&#])(?:_gac=[^&#]*)(?:&?)(.*)/; | |
function Bc(a) { | |
var b = a.get(clientIdEntry) | |
, c = a.get(_gidEntry) || ""; | |
b = "_ga=2." + encodeURIComponent_(pa(c + b, 0) + "." + c + "-" + b); | |
if ((c = a.get(ce)) && a.get(je)) { | |
var d = R(a, fe); | |
1000 * d + R(a, he) <= (new Date).getTime() ? (TrackEnvFlag(76), | |
a = "") : (TrackEnvFlag(44), | |
a = "&_gac=1." + encodeURIComponent_([pa(c, 0), d, c].join("."))) | |
} else | |
a = ""; | |
return b + a | |
} | |
function Ic(a, b) { | |
var c = new Date | |
, NAVIGATOR = WINDOW.navigator | |
, e = NAVIGATOR.plugins || []; | |
a = [a, NAVIGATOR.userAgent, c.getTimezoneOffset(), c.getYear(), c.getDate(), c.getHours(), c.getMinutes() + b]; | |
for (b = 0; b < e.length; ++b) | |
a.push(e[b].description); | |
return La(a.join(".")) | |
} | |
function pa(a, b) { | |
var c = new Date | |
, NAVIGATOR = WINDOW.navigator | |
, e = c.getHours() + Math.floor((c.getMinutes() + b) / 60); | |
return La([a, NAVIGATOR.userAgent, NAVIGATOR.language || "", c.getTimezoneOffset(), c.getYear(), c.getDate() + Math.floor(e / 24), (24 + e) % 24, (60 + c.getMinutes() + b) % 60].join(".")) | |
} | |
var Linker = function(a) { | |
TrackEnvFlag(48); | |
this.target = a; | |
this.T = false | |
}; | |
Linker.prototype.ca = function(a, b) { | |
if (a.tagName) { | |
if ("a" == a.tagName.toLowerCase()) { | |
a.href && (a.href = qd(this, a.href, b)); | |
return | |
} | |
if ("form" == a.tagName.toLowerCase()) | |
return rd(this, a) | |
} | |
if ("string" == typeof a) | |
return qd(this, a, b) | |
} | |
; | |
var qd = function(a, b, c) { | |
var d = pd.exec(b); | |
d && 3 <= d.length && (b = d[1] + (d[3] ? d[2] + d[3] : "")); | |
(d = me.exec(b)) && 3 <= d.length && (b = d[1] + (d[3] ? d[2] + d[3] : "")); | |
a = a.target.get("linkerParam"); | |
var e = b.indexOf("?"); | |
d = b.indexOf("#"); | |
c ? b += (-1 == d ? "#" : "&") + a : (c = -1 == e ? "?" : "&", | |
b = -1 == d ? b + (c + a) : b.substring(0, d) + c + a + b.substring(d)); | |
b = b.replace(/&+_ga=/, "&_ga="); | |
return b = b.replace(/&+_gac=/, "&_gac=") | |
} | |
, rd = function(a, b) { | |
if (b && b.action) | |
if ("get" == b.method.toLowerCase()) { | |
a = a.target.get("linkerParam").split("&"); | |
for (var c = 0; c < a.length; c++) { | |
var d = a[c].split("=") | |
, e = d[1]; | |
d = d[0]; | |
for (var g = b.childNodes || [], ca = false, l = 0; l < g.length; l++) | |
if (g[l].name == d) { | |
g[l].setAttribute("value", e); | |
ca = true; | |
break | |
} | |
ca || (g = DOCUMENT.createElement("input"), | |
g.setAttribute("type", "hidden"), | |
g.setAttribute("name", d), | |
g.setAttribute("value", e), | |
b.appendChild(g)) | |
} | |
} else | |
"post" == b.method.toLowerCase() && (b.action = qd(a, b.action)) | |
}; | |
Linker.prototype.S = function(a, b, c) { | |
function d(c) { | |
try { | |
c = c || WINDOW.event; | |
a: { | |
var d = c.target || c.srcElement; | |
for (c = 100; d && 0 < c; ) { | |
if (d.href && d.nodeName.match(/^a(?:rea)?$/i)) { | |
var g = d; | |
break a | |
} | |
d = d.parentNode; | |
c-- | |
} | |
g = {} | |
} | |
("http:" == g.protocol || "https:" == g.protocol) && isSomethingDoesSomething(a, g.hostname || "") && g.href && (g.href = qd(dc, g.href, b)) | |
} catch (k) { | |
TrackEnvFlag(26) | |
} | |
} | |
var dc = this; | |
this.T || (this.T = true, | |
addEventListener_(DOCUMENT, "mousedown", d, false), | |
addEventListener_(DOCUMENT, "keyup", d, false)); | |
c && addEventListener_(DOCUMENT, "submit", function(e) { | |
e = e || WINDOW.event; | |
if ((e = e.target || e.srcElement) && e.action) { | |
var c = e.action.match(isProtocol); | |
c && isSomethingDoesSomething(a, c[1]) && rd(dc, e) | |
} | |
}) | |
} | |
; | |
function isSomethingDoesSomething(a, b) { | |
if (b == DOCUMENT.location.hostname) | |
return false; | |
for (var c = 0; c < a.length; c++) | |
if (a[c]instanceof RegExp) { | |
if (a[c].test(b)) | |
return true | |
} else if (0 <= b.indexOf(a[c])) | |
return true; | |
return false | |
} | |
function ke(a, b) { | |
return b != Ic(a, 0) && b != Ic(a, -1) && b != Ic(a, -2) && b != pa(a, 0) && b != pa(a, -1) && b != pa(a, -2) | |
} | |
;var p = /^(GTM|OPT)-[A-Z0-9]+$/ | |
, q = /;_gaexp=[^;]*/g | |
, r = /;((__utma=)|([^;=]+=GAX?\d+\.))[^;]*/g | |
, Aa = /^https?:\/\/[\w\-.]+\.google.com(:\d+)?\/optimize\/opt-launch\.html\?.*$/ | |
, buildGtmUrl = function(opts) { | |
function addQueryParam(key, value) { | |
value && (url += "&" + key + "=" + encodeURIComponent_(value)) | |
} | |
var url = "https://www.google-analytics.com/gtm/js?id=" + encodeURIComponent_(opts.id); | |
"dataLayer" != opts.B && addQueryParam("l", opts.B); | |
addQueryParam("t", opts.target); | |
addQueryParam("cid", opts.clientId); | |
addQueryParam("cidt", opts.ka); | |
addQueryParam("gac", opts.la); | |
addQueryParam("aip", opts.ia); | |
opts.sync && addQueryParam("m", "sync"); | |
addQueryParam("cycle", opts.G); | |
opts.qa && addQueryParam("gclid", opts.qa); | |
Aa.test(DOCUMENT.referrer) && addQueryParam("cb", String(getMathRandomInt())); | |
return url | |
}; | |
var Jd = function(a, b, c) { | |
this.aa = b; | |
(b = c) || (b = (b = P(a, nameEntry)) && "t0" != b ? gtmRegEx.test(b) ? "_gat_" + encodeURIComponentSlashes(P(a, trackingIdEntry)) : "_gat_" + encodeURIComponentSlashes(b) : "_gat"); | |
this.Y = b | |
} | |
, Rd = function(a, b) { | |
var c = b.get(Wb); | |
b.set(Wb, function(b) { | |
Pd(a, b, _j1Entry); | |
Pd(a, b, _j2Entry); | |
var d = c(b); | |
Qd(a, b); | |
return d | |
}); | |
var d = b.get(Xb); | |
b.set(Xb, function(b) { | |
var c = d(b); | |
if (b.get(_j1Entry)) { | |
if (ne()) { | |
TrackEnvFlag(80); | |
var context = { | |
U: re(a, b, 1), // this is a query string | |
google: re(a, b, 2), | |
count: 0 | |
}; | |
sendSimpleRequest("https://stats.g.doubleclick.net/j/collect", context.U, context) | |
} else | |
createImgEl(re(a, b, 0)); | |
b.set(_j1Entry, "", true) | |
} | |
return c | |
}) | |
} | |
, Pd = function(a, b, c) { | |
b.get(c) || ("1" == parseCookies(a.Y)[0] ? b.set(c, "", true) : b.set(c, "" + getMathRandomInt(), true)) | |
} | |
, Qd = function(a, b) { | |
b.get(_j1Entry) && zc(a.Y, "1", b.get(cookiePathEntry), b.get(cookieDomainEntry), b.get(trackingIdEntry), 6E4) | |
} | |
, re = function(a, b, c) { | |
var d = new IterableMap | |
, e = function(a) { | |
$a(a).F && d.set($a(a).F, b.get(a)) | |
}; | |
e(apiVersionEntry); | |
e(clientVersionEntry); | |
e(trackingIdEntry); | |
e(clientIdEntry); | |
e(_j1Entry); | |
if (0 == c || 1 == c) | |
e(userIdEntry), | |
e(_j2Entry), | |
e(_gidEntry); | |
d.set($a(usageEntry).F, getEncodedEnvTracker(b)); | |
var g = ""; | |
d.map(function(a, b) { | |
g += encodeURIComponent_(a) + "="; | |
g += encodeURIComponent_("" + b) + "&" | |
}); | |
g += "z=" + getMathRandomInt(); | |
0 == c ? g = a.aa + g : 1 == c ? g = "t=dc&aip=1&_r=3&" + g : 2 == c && (g = "t=sr&aip=1&_r=4&slf_rd=1&" + g); | |
return g | |
} | |
, gtmRegEx = /^gtm\d+$/; | |
var fd = function(a, b) { | |
a = a.b; | |
if (!a.get("dcLoaded")) { | |
var c = new EnvTracker(Dd(a)); | |
c.set(29); | |
a.set(_umEntry, c.flags); | |
b = b || {}; | |
var d; | |
b[cookieNameEntry] && (d = encodeURIComponentSlashes(b[cookieNameEntry])); | |
b = new Jd(a,"https://stats.g.doubleclick.net/r/collect?t=dc&aip=1&_r=3&",d); | |
Rd(b, a); | |
a.set("dcLoaded", true) | |
} | |
}; | |
var Sd = function(a) { | |
if (!a.get("dcLoaded") && "cookie" == a.get(storageEntry)) { | |
var b = new Jd(a); | |
Pd(b, a, _j1Entry); | |
Pd(b, a, _j2Entry); | |
Qd(b, a); | |
a.get(_j1Entry) && (a.set(Md, 1, true), | |
ne() ? (TrackEnvFlag(79), | |
a.set(gd, oe() + "/j/collect", true), | |
a.set(qe, { | |
U: re(b, a, 1), | |
google: re(b, a, 2), | |
count: 0 | |
}, true)) : a.set(gd, oe() + "/r/collect", true)) | |
} | |
}; | |
var Lc = function() { | |
var gaGlobalRef = WINDOW.gaGlobal = WINDOW.gaGlobal || {}; | |
return gaGlobalRef.hid = gaGlobalRef.hid || getMathRandomInt() | |
}; | |
var ad, bd = function(a, b, c) { | |
if (!ad) { | |
var d = DOCUMENT.location.hash; | |
var NAME = WINDOW.name | |
, g = /^#?gaso=([^&]*)/; | |
if (NAME = (d = (d = d && d.match(g) || NAME && NAME.match(g)) ? d[1] : parseCookies("GASO")[0] || "") && d.match(/^(?:!([-0-9a-z.]{1,40})!)?([-.\w]{10,1200})$/i)) | |
zc("GASO", "" + d, c, b, a, 0), | |
window._udo || (window._udo = b), | |
window._utcp || (window._utcp = c), | |
a = NAME[1], | |
addScriptEl("https://www.google.com/analytics/web/inpage/pub/inpage.js?" + (a ? "prefix=" + a + "&" : "") + getMathRandomInt(), "_gasojs"); | |
ad = true | |
} | |
}; | |
var H = function(a) { | |
return a ? (1 * a).toFixed(3) : "0" | |
} | |
, da = function(a) { | |
var performanceData = WINDOW.performance; | |
if (performanceData && performanceData.getEntriesByName) { | |
TrackEnvFlag(35); | |
var c = "https://www.google-analytics.com/analytics.js?wpid=" + a; | |
addScriptEl(c, undefined, undefined, function() { | |
try { | |
var d = 1 | |
, e = performanceData.getEntriesByName("https://www.google-analytics.com/analytics.js"); | |
e && 0 != e.length || (e = performanceData.getEntriesByName("http://www.google-analytics.com/analytics.js"), | |
d = 0); | |
var g = performanceData.getEntriesByName(c); | |
if (e && 1 == e.length && g && 1 == g.length) { | |
TrackEnvFlag(37); | |
var ca = e[0] | |
, l = g[0] | |
, k = { | |
tid: a, | |
ad: H(ca.duration), | |
bd: H(l.duration), | |
ar: H(ca.responseEnd - ca.requestStart), | |
br: H(l.responseEnd - l.requestStart), | |
an: H(ca.domainLookupEnd - ca.domainLookupStart), | |
bn: H(l.domainLookupEnd - l.domainLookupStart), | |
ac: H(ca.connectEnd - ca.connectStart), | |
bc: H(l.connectEnd - l.connectStart), | |
as: d | |
}; | |
d = []; | |
d.push("_v=j66"); | |
d.push("id=10"); | |
for (var w in k) | |
k.hasOwnProperty(w) && d.push(w + "=" + encodeURIComponent_(k[w])); | |
d.push("z=" + getMathRandomInt()); | |
createImgElForOriginAndQuery("https://www.google-analytics.com/u/d", d.join("&"), noop) | |
} | |
} catch (ha) {} | |
}) | |
} | |
}; | |
var wb = /^(UA|YT|MO|GP)-(\d+)-(\d+)$/ | |
, pc = function(a) { | |
function b(a, b) { | |
d.b.data.set(a, b) | |
} | |
function c(a, c) { | |
b(a, c); | |
d.filters.add(a) | |
} | |
var d = this; | |
this.b = new DataHolder; | |
this.filters = new Ha; | |
b(nameEntry, a[nameEntry]); | |
b(trackingIdEntry, formatGAStr(a[trackingIdEntry])); | |
b(cookieNameEntry, a[cookieNameEntry]); | |
b(cookieDomainEntry, a[cookieDomainEntry] || returnSubdomainOrHostnameIfWWW()); | |
b(cookiePathEntry, a[cookiePathEntry]); | |
b(cookieExpiresEntry, a[cookieExpiresEntry]); | |
b(cookieUpdateEntry, a[cookieUpdateEntry]); | |
b(legacyCookieDomainEntry, a[legacyCookieDomainEntry]); | |
b(legacyHistoryImportEntry, a[legacyHistoryImportEntry]); | |
b(allowLinkerEntry, a[allowLinkerEntry]); | |
b(allowAnchorEntry, a[allowAnchorEntry]); | |
b(sampleRateEntry, a[sampleRateEntry]); | |
b(siteSpeedSampleRateEntry, a[siteSpeedSampleRateEntry]); | |
b(alwaysSendReferrerEntry, a[alwaysSendReferrerEntry]); | |
b(storageEntry, a[storageEntry]); | |
b(userIdEntry, a[userIdEntry]); | |
b(clientIdTimeEntry, a[clientIdTimeEntry]); | |
b(Kd, a[Kd]); | |
b(je, a[je]); | |
b(apiVersionEntry, 1); | |
b(clientVersionEntry, "j66"); | |
c(_ootEntry, Ma); | |
c(oa, noop); | |
c(previewTaskEntry, cd); | |
c(Rb, Oa); | |
c(md, vb); | |
c(Sb, nc); | |
c(Uc, Yc); | |
c(Tb, Ja); | |
c(Vb, Ta); | |
c(Vc, Hc); | |
c(zd, yd); | |
c(Ld, Sd); | |
c(Wb, Pa); | |
c(Xb, Sa); | |
c(Cd, Fd(this)); | |
Kc(this.b); | |
Jc(this.b, a[clientIdEntry]); | |
this.b.set(adSenseIdEntry, Lc()); | |
bd(this.b.get(trackingIdEntry), this.b.get(cookieDomainEntry), this.b.get(cookiePathEntry)); | |
this.ra = new Od(true,"gaexp10") | |
} | |
, Jc = function(a, b) { | |
var c = P(a, cookieNameEntry); | |
a.data.set(la, "_ga" == c ? "_gid" : c + "_gid"); | |
if ("cookie" == P(a, storageEntry)) { | |
hc = false; | |
c = parseCookies(P(a, cookieNameEntry)); | |
c = Xd(a, c); | |
if (!c) { | |
c = P(a, cookieDomainEntry); | |
var d = P(a, legacyCookieDomainEntry) || returnSubdomainOrHostnameIfWWW(); | |
c = Xc("__utma", d, c); | |
undefined != c ? (TrackEnvFlag(10), | |
c = c.O[1] + "." + c.O[2]) : c = undefined | |
} | |
c && (hc = true); | |
if (d = c && !a.get(cookieUpdateEntry)) | |
if (d = c.split("."), | |
2 != d.length) | |
d = false; | |
else if (d = Number(d[1])) { | |
var e = R(a, cookieExpiresEntry); | |
d = d + e < (new Date).getTime() / 1000 | |
} else | |
d = false; | |
d && (c = undefined); | |
c && (a.data.set(storedClientIdEntry, c), | |
a.data.set(clientIdEntry, c), | |
c = parseCookies(P(a, la)), | |
(c = Xd(a, c)) && a.data.set(_gidEntry, c)); | |
if (a.get(je) && (c = a.get(ce), | |
d = a.get(ie), | |
!c || d && "aw.ds" != d)) { | |
c = {}; | |
if (DOCUMENT) { | |
d = []; | |
e = DOCUMENT.cookie.split(";"); | |
for (var g = /^\s*_gac_(UA-\d+-\d+)=\s*(.+?)\s*$/, ca = 0; ca < e.length; ca++) { | |
var l = e[ca].match(g); | |
l && d.push({ | |
ja: l[1], | |
value: l[2] | |
}) | |
} | |
e = {}; | |
if (d && d.length) | |
for (g = 0; g < d.length; g++) | |
(ca = d[g].value.split("."), | |
"1" != ca[0] || 3 != ca.length) ? c && (c.na = true) : ca[1] && (e[d[g].ja] ? c && (c.pa = true) : e[d[g].ja] = [], | |
e[d[g].ja].push({ | |
timestamp: ca[1], | |
qa: ca[2] | |
})); | |
d = e | |
} else | |
d = {}; | |
d = d[P(a, trackingIdEntry)]; | |
le(c); | |
d && 0 != d.length && (c = d[0], | |
a.data.set(fe, c.timestamp), | |
a.data.set(ce, c.qa)) | |
} | |
} | |
if (a.get(cookieUpdateEntry)) | |
a: if (d = getUrlParam("_ga", a.get(allowAnchorEntry))) | |
if (a.get(allowLinkerEntry)) | |
if (c = d.indexOf("."), | |
-1 == c) | |
TrackEnvFlag(22); | |
else { | |
e = d.substring(0, c); | |
g = d.substring(c + 1); | |
c = g.indexOf("."); | |
d = g.substring(0, c); | |
g = g.substring(c + 1); | |
if ("1" == e) { | |
if (c = g, | |
ke(c, d)) { | |
TrackEnvFlag(23); | |
break a | |
} | |
} else if ("2" == e) { | |
c = g.indexOf("-"); | |
e = ""; | |
0 < c ? (e = g.substring(0, c), | |
c = g.substring(c + 1)) : c = g.substring(1); | |
if (ke(e + c, d)) { | |
TrackEnvFlag(53); | |
break a | |
} | |
e && (TrackEnvFlag(2), | |
a.data.set(_gidEntry, e)) | |
} else { | |
TrackEnvFlag(22); | |
break a | |
} | |
TrackEnvFlag(11); | |
a.data.set(clientIdEntry, c); | |
if (c = getUrlParam("_gac", a.get(allowAnchorEntry))) | |
c = c.split("."), | |
"1" != c[0] || 4 != c.length ? TrackEnvFlag(72) : ke(c[3], c[1]) ? TrackEnvFlag(71) : (a.data.set(ce, c[3]), | |
a.data.set(fe, c[2]), | |
TrackEnvFlag(70)) | |
} | |
else | |
TrackEnvFlag(21); | |
b && (TrackEnvFlag(9), | |
a.data.set(clientIdEntry, encodeURIComponent_(b))); | |
a.get(clientIdEntry) || ((b = (b = WINDOW.gaGlobal && WINDOW.gaGlobal.vid) && -1 != b.search(utmaRegEx) ? b : undefined) ? (TrackEnvFlag(17), | |
a.data.set(clientIdEntry, b)) : (TrackEnvFlag(8), | |
a.data.set(clientIdEntry, calcFingerprint()))); | |
a.get(_gidEntry) || (TrackEnvFlag(3), | |
a.data.set(_gidEntry, calcFingerprint())); | |
mc(a) | |
} | |
, Kc = function(a) { | |
var NAVIGATOR = WINDOW.navigator | |
, SCREEN = WINDOW.screen | |
, LOCATION = DOCUMENT.location; | |
a.set(referrerEntry, ya(a.get(alwaysSendReferrerEntry), a.get(Kd))); | |
if (LOCATION) { | |
var e = LOCATION.pathname || ""; | |
"/" != e.charAt(0) && (TrackEnvFlag(31), | |
e = "/" + e); | |
a.set(locationEntry, LOCATION.protocol + "//" + LOCATION.hostname + e + LOCATION.search) | |
} | |
SCREEN && a.set(screenResolutionEntry, SCREEN.width + "x" + SCREEN.height); | |
SCREEN && a.set(screenColorsEntry, SCREEN.colorDepth + "-bit"); | |
var documentEl = DOCUMENT.documentElement; | |
var g = (e = DOCUMENT.body) && e.clientWidth && e.clientHeight | |
, ca = []; | |
documentEl && documentEl.clientWidth && documentEl.clientHeight && ("CSS1Compat" === DOCUMENT.compatMode || !g) ? ca = [documentEl.clientWidth, documentEl.clientHeight] : g && (ca = [e.clientWidth, e.clientHeight]); | |
var viewportSizeVal = 0 >= ca[0] || 0 >= ca[1] ? "" : ca.join("x"); | |
a.set(viewportSizeEntry, viewportSizeVal); | |
a.set(flashVersionEntry, getFlashVersion()); | |
a.set(encodingEntry, DOCUMENT.characterSet || DOCUMENT.charset); | |
a.set(javaEnabledEntry, NAVIGATOR && "function" === typeof NAVIGATOR.javaEnabled && NAVIGATOR.javaEnabled() || false); | |
a.set(languageEntry, (NAVIGATOR && (NAVIGATOR.language || NAVIGATOR.browserLanguage) || "").toLowerCase()); | |
a.data.set(ce, getUrlParam("gclid", true)); | |
a.data.set(ie, getUrlParam("gclsrc", true)); | |
a.data.set(fe, Math.round((new Date).getTime() / 1000)); | |
var hashParams; | |
if (LOCATION && a.get(allowAnchorEntry) && (hashParams = DOCUMENT.location.hash)) { | |
hashParams = hashParams.split(/[?&#]+/); | |
var vals = []; | |
for (var s = 0; s < hashParams.length; ++s) | |
(contains(hashParams[s], "utm_id") || contains(hashParams[s], "utm_campaign") || contains(hashParams[s], "utm_source") || contains(hashParams[s], "utm_medium") || contains(hashParams[s], "utm_term") || contains(hashParams[s], "utm_content") || contains(hashParams[s], "gclid") || contains(hashParams[s], "dclid") || contains(hashParams[s], "gclsrc")) && vals.push(hashParams[s]); | |
0 < vals.length && (hashParams = "#" + vals.join("&"), | |
a.set(locationEntry, a.get(locationEntry) + hashParams)) | |
} | |
}; | |
pc.prototype.get = function(a) { | |
return this.b.get(a) | |
} | |
; | |
pc.prototype.set = function(a, b) { | |
this.b.set(a, b) | |
} | |
; | |
var qc = { | |
pageview: [pageEntry], | |
event: [eventCategoryEntry, eventActionEntry, eventLabelEntry, eventValueEntry], | |
social: [socialNetworkEntry, socialActionEntry, socialTargetEntry], | |
timing: [timingCategoryEntry, timingVarEntry, timingValueEntry, timingLabelEntry] | |
}; | |
pc.prototype.send = function(a) { | |
if (!(1 > arguments.length)) { | |
if ("string" === typeof arguments[0]) { | |
var b = arguments[0]; | |
var c = [].slice.call(arguments, 1) | |
} else | |
b = arguments[0] && arguments[0][hitTypeEntry], | |
c = arguments; | |
b && (c = za(qc[b] || [], c), | |
c[hitTypeEntry] = b, | |
this.b.set(c, undefined, true), | |
this.filters.D(this.b), | |
this.b.data.m = {}, | |
Ed(this.ra, this.b) && da(this.b.get(trackingIdEntry))) | |
} | |
} | |
; | |
pc.prototype.ma = function(a, b) { | |
var c = this; | |
u(a, c, b) || (v(a, function() { | |
u(a, c, b) | |
}), | |
y(String(c.get(nameEntry)), a, undefined, b, true)) | |
} | |
; | |
var rc = function(a) { | |
if ("prerender" == DOCUMENT.visibilityState) | |
return false; | |
a(); | |
return true | |
} | |
, z = function(a) { | |
if (!rc(a)) { | |
TrackEnvFlag(16); | |
var b = false | |
, c = function() { | |
if (!b && rc(a)) { | |
b = true; | |
var d = c | |
, e = DOCUMENT; | |
e.removeEventListener ? e.removeEventListener("visibilitychange", d, false) : e.detachEvent && e.detachEvent("onvisibilitychange", d) | |
} | |
}; | |
addEventListener_(DOCUMENT, "visibilitychange", c) | |
} | |
}; | |
var td = /^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/ | |
, sc = function(a) { | |
if (isFunction(a[0])) | |
this.u = a[0]; | |
else { | |
var b = td.exec(a[0]); | |
null != b && 4 == b.length && (this.c = b[1] || "t0", | |
this.K = b[2] || "", | |
this.C = b[3], | |
this.a = [].slice.call(a, 1), | |
this.K || (this.A = "create" == this.C, | |
this.i = "require" == this.C, | |
this.g = "provide" == this.C, | |
this.ba = "remove" == this.C), | |
this.i && (3 <= this.a.length ? (this.X = this.a[1], | |
this.W = this.a[2]) : this.a[1] && (isString(this.a[1]) ? this.X = this.a[1] : this.W = this.a[1]))); | |
b = a[1]; | |
a = a[2]; | |
if (!this.C) | |
throw "abort"; | |
if (this.i && (!isString(b) || "" == b)) | |
throw "abort"; | |
if (this.g && (!isString(b) || "" == b || !isFunction(a))) | |
throw "abort"; | |
if (ud(this.c) || ud(this.K)) | |
throw "abort"; | |
if (this.g && "t0" != this.c) | |
throw "abort"; | |
} | |
}; | |
function ud(a) { | |
return 0 <= a.indexOf(".") || 0 <= a.indexOf(":") | |
} | |
;var Yd, Zd, $d, A; | |
Yd = new IterableMap; | |
$d = new IterableMap; | |
A = new IterableMap; | |
Zd = { | |
ec: 45, | |
ecommerce: 46, | |
linkid: 47 | |
}; | |
var u = function(a, b, c) { | |
b == N || b.get(nameEntry); | |
var d = Yd.get(a); | |
if (!isFunction(d)) | |
return false; | |
b.plugins_ = b.plugins_ || new IterableMap; | |
if (b.plugins_.get(a)) | |
return true; | |
b.plugins_.set(a, new d(b,c || {})); | |
return true | |
} | |
, y = function(a, b, c, d, e) { | |
if (!isFunction(Yd.get(b)) && !$d.get(b)) { | |
Zd.hasOwnProperty(b) && TrackEnvFlag(Zd[b]); | |
if (p.test(b)) { | |
TrackEnvFlag(52); | |
a = N.j(a); | |
if (!a) | |
return true; | |
c = d || {}; | |
var opts = { | |
id: b, | |
B: c.dataLayer || "dataLayer", | |
ia: !!a.get("anonymizeIp"), | |
sync: e, | |
G: false | |
}; | |
a.get(">m") == b && (opts.G = true); | |
var g = String(a.get("name")); | |
"t0" != g && (opts.target = g); | |
G(String(a.get("trackingId"))) || (opts.clientId = String(a.get(clientIdEntry)), | |
opts.ka = Number(a.get(clientIdTimeEntry)), | |
c = c.palindrome ? r : q, | |
c = (c = DOCUMENT.cookie.replace(/^|(; +)/g, ";").match(c)) ? c.sort().join("").substring(1) : undefined, | |
opts.la = c, | |
opts.qa = parseUrlParam(a.b.get(locationEntry) || "", "gclid")); | |
a = opts.B; | |
c = (new Date).getTime(); | |
WINDOW[a] = WINDOW[a] || []; | |
c = { | |
"gtm.start": c | |
}; | |
e || (c.event = "gtm.js"); | |
WINDOW[a].push(c); | |
c = buildGtmUrl(opts) | |
} | |
!c && Zd.hasOwnProperty(b) ? (TrackEnvFlag(39), | |
c = b + ".js") : TrackEnvFlag(43); | |
c && (c && 0 <= c.indexOf("/") || (c = (Ba || isHttps() ? "https:" : "http:") + "//www.google-analytics.com/plugins/ua/" + c), | |
opts = ae(c), | |
a = opts.protocol, | |
c = DOCUMENT.location.protocol, | |
("https:" == a || a == c || ("http:" != a ? 0 : "http:" == c)) && B(opts) && (addScriptEl(opts.url, undefined, e), | |
$d.set(b, true))) | |
} | |
} | |
, v = function(a, b) { | |
var c = A.get(a) || []; | |
c.push(b); | |
A.set(a, c) | |
} | |
, C = function(a, b) { | |
Yd.set(a, b); | |
b = A.get(a) || []; | |
for (var c = 0; c < b.length; c++) | |
b[c](); | |
A.set(a, []) | |
} | |
, B = function(a) { | |
var b = ae(DOCUMENT.location.href); | |
if (contains(a.url, "https://www.google-analytics.com/gtm/js?id=")) | |
return true; | |
if (a.query || 0 <= a.url.indexOf("?") || 0 <= a.path.indexOf("://")) | |
return false; | |
if (a.host == b.host && a.port == b.port) | |
return true; | |
b = "http:" == a.protocol ? 80 : 443; | |
return "www.google-analytics.com" == a.host && (a.port || b) == b && contains(a.path, "/plugins/") ? true : false | |
} | |
, ae = function(a) { | |
function b(a) { | |
var b = (a.hostname || "").split(":")[0].toLowerCase() | |
, c = (a.protocol || "").toLowerCase(); | |
c = 1 * a.port || ("http:" == c ? 80 : "https:" == c ? 443 : ""); | |
a = a.pathname || ""; | |
contains(a, "/") || (a = "/" + a); | |
return [b, "" + c, a] | |
} | |
var c = DOCUMENT.createElement("a"); | |
c.href = DOCUMENT.location.href; | |
var d = (c.protocol || "").toLowerCase() | |
, e = b(c) | |
, g = c.search || "" | |
, ca = d + "//" + e[0] + (e[1] ? ":" + e[1] : ""); | |
contains(a, "//") ? a = d + a : contains(a, "/") ? a = ca + a : !a || contains(a, "?") ? a = ca + e[2] + (a || g) : 0 > a.split("/")[0].indexOf(":") && (a = ca + e[2].substring(0, e[2].lastIndexOf("/")) + "/" + a); | |
c.href = a; | |
d = b(c); | |
return { | |
protocol: (c.protocol || "").toLowerCase(), | |
host: d[0], | |
port: d[1], | |
path: d[2], | |
query: c.search || "", | |
url: a || "" | |
} | |
}; | |
var Z = { | |
ga: function() { | |
Z.f = [] | |
} | |
}; | |
Z.ga(); | |
Z.D = function(a) { | |
var b = Z.J.apply(Z, arguments); | |
b = Z.f.concat(b); | |
for (Z.f = []; 0 < b.length && !Z.v(b[0]) && !(b.shift(), | |
0 < Z.f.length); ) | |
; | |
Z.f = Z.f.concat(b) | |
} | |
; | |
Z.J = function(a) { | |
for (var b = [], c = 0; c < arguments.length; c++) | |
try { | |
var d = new sc(arguments[c]); | |
d.g ? C(d.a[0], d.a[1]) : (d.i && (d.ha = y(d.c, d.a[0], d.X, d.W)), | |
b.push(d)) | |
} catch (e) {} | |
return b | |
} | |
; | |
Z.v = function(a) { | |
try { | |
if (a.u) | |
a.u.call(WINDOW, N.j("t0")); | |
else { | |
var b = a.c == gaFnName ? N : N.j(a.c); | |
if (a.A) { | |
if ("t0" == a.c && (b = N.create.apply(N, a.a), | |
null === b)) | |
return true | |
} else if (a.ba) | |
N.remove(a.c); | |
else if (b) | |
if (a.i) { | |
if (a.ha && (a.ha = y(a.c, a.a[0], a.X, a.W)), | |
!u(a.a[0], b, a.W)) | |
return true | |
} else if (a.K) { | |
var c = a.C | |
, d = a.a | |
, e = b.plugins_.get(a.K); | |
e[c].apply(e, d) | |
} else | |
b[a.C].apply(b, a.a) | |
} | |
} catch (g) {} | |
} | |
; | |
var N = function(a) { | |
TrackEnvFlag(1); | |
Z.D.apply(Z, [arguments]) | |
}; | |
N.h = {}; | |
N.P = []; | |
N.L = 0; | |
N.answer = 42; | |
var uc = [trackingIdEntry, cookieDomainEntry, nameEntry]; | |
N.create = function(a) { | |
var b = za(uc, [].slice.call(arguments)); | |
b[nameEntry] || (b[nameEntry] = "t0"); | |
var c = "" + b[nameEntry]; | |
if (N.h[c]) | |
return N.h[c]; | |
a: { | |
if (b[Kd]) { | |
TrackEnvFlag(67); | |
if (b[storageEntry] && "cookie" != b[storageEntry]) { | |
var d = false; | |
break a | |
} | |
if (undefined !== Ab) | |
b[clientIdEntry] || (b[clientIdEntry] = Ab); | |
else { | |
b: { | |
d = String(b[cookieDomainEntry] || returnSubdomainOrHostnameIfWWW()); | |
var e = String(b[cookiePathEntry] || "/") | |
, g = parseCookies(String(b[cookieNameEntry] || "_ga")); | |
d = na(g, d, e); | |
if (!d || utmaRegEx.test(d)) | |
d = true; | |
else if (d = parseCookies("AMP_TOKEN"), | |
0 == d.length) | |
d = true; | |
else { | |
if (1 == d.length && (d = decodeURIComponent(d[0]), | |
"$RETRIEVING" == d || "$OPT_OUT" == d || "$ERROR" == d || "$NOT_FOUND" == d)) { | |
d = true; | |
break b | |
} | |
d = false | |
} | |
} | |
if (d && tc(ic, String(b[trackingIdEntry]))) { | |
d = true; | |
break a | |
} | |
} | |
} | |
d = false | |
} | |
if (d) | |
return null; | |
b = new pc(b); | |
N.h[c] = b; | |
N.P.push(b); | |
return b | |
} | |
; | |
N.remove = function(a) { | |
for (var b = 0; b < N.P.length; b++) | |
if (N.P[b].get(nameEntry) == a) { | |
N.P.splice(b, 1); | |
N.h[a] = null; | |
break | |
} | |
} | |
; | |
N.j = function(a) { | |
return N.h[a] | |
} | |
; | |
N.getAll = function() { | |
return N.P.slice(0) | |
} | |
; | |
N.N = function() { | |
"ga" != gaFnName && TrackEnvFlag(49); | |
var a = WINDOW[gaFnName]; | |
if (!a || 42 != a.answer) { | |
N.L = a && a.l; | |
N.loaded = true; | |
var b = WINDOW[gaFnName] = N; | |
X("create", b, b.create); | |
X("remove", b, b.remove); | |
X("getByName", b, b.j, 5); | |
X("getAll", b, b.getAll, 6); | |
b = pc.prototype; | |
X("get", b, b.get, 7); | |
X("set", b, b.set, 4); | |
X("send", b, b.send); | |
X("requireSync", b, b.ma); | |
b = DataHolder.prototype; | |
X("get", b, b.get); | |
X("set", b, b.set); | |
if (!isHttps() && !Ba) { | |
a: { | |
b = DOCUMENT.getElementsByTagName("script"); | |
for (var c = 0; c < b.length && 100 > c; c++) { | |
var d = b[c].src; | |
if (d && 0 == d.indexOf("https://www.google-analytics.com/analytics")) { | |
b = true; | |
break a | |
} | |
} | |
b = false | |
} | |
b && (Ba = true) | |
} | |
isHttps() || Ba || !Ed(new Od) || (Ba = true); | |
(WINDOW.gaplugins = WINDOW.gaplugins || {}).Linker = Linker; | |
b = Linker.prototype; | |
C("linker", Linker); | |
X("decorate", b, b.ca, 20); | |
X("autoLink", b, b.S, 25); | |
C("displayfeatures", fd); | |
C("adfeatures", fd); | |
a = a && a.q; | |
isArray(a) ? Z.D.apply(N, a) : TrackEnvFlag(50) | |
} | |
} | |
; | |
N.da = function() { | |
for (var a = N.getAll(), b = 0; b < a.length; b++) | |
a[b].get(nameEntry) | |
} | |
; | |
var Nd = N.N | |
, se = WINDOW[gaFnName]; | |
se && se.r ? Nd() : z(Nd); | |
z(function() { | |
Z.D(["provide", "render", noop]) | |
}); | |
function La(a) { | |
var b = 1, c; | |
if (a) | |
for (b = 0, | |
c = a.length - 1; 0 <= c; c--) { | |
var d = a.charCodeAt(c); | |
b = (b << 6 & 268435455) + d + (d << 14); | |
d = b & 266338304; | |
b = 0 != d ? b ^ d >> 21 : b | |
} | |
return b | |
} | |
; | |
} | |
)(window); |
Hmm. Good question. I stopped reverse engineering this a while back, but lukeed’s https://github.com/lukeed/ganalytics is very simple to use for documented parameters.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great work! Maybe with this one can find out and prove (!) what the _jid (jid) parameter is for. In unofficial sources I found "Join ID for DoubleClick beacon".