Skip to content

Instantly share code, notes, and snippets.

@miguelramos
Created September 22, 2015 13:57
Show Gist options
  • Save miguelramos/dc771c7f8942094a8b50 to your computer and use it in GitHub Desktop.
Save miguelramos/dc771c7f8942094a8b50 to your computer and use it in GitHub Desktop.
Analytics.js Google Source
(function() {
/**
* @param {number} opt_attributes
* @return {undefined}
*/
function replace(opt_attributes) {
map.set(opt_attributes);
}
/**
* @param {Object} context
* @return {undefined}
*/
function install(context) {
if (100 != context.get(id) && escape(done(context, hash)) % 1E4 >= 100 * fn(context, id)) {
throw "abort";
}
}
/**
* @param {Object} err
* @return {undefined}
*/
function finish(err) {
if (hasClass(done(err, n))) {
throw "abort";
}
}
/**
* @return {undefined}
*/
function restoreScript() {
/** @type {string} */
var u = doc.location.protocol;
if ("http:" != u && "https:" != u) {
throw "abort";
}
}
/**
* @param {Object} t
* @return {undefined}
*/
function load(t) {
try {
if (global.navigator.sendBeacon) {
replace(42);
} else {
if (global.XMLHttpRequest) {
if ("withCredentials" in new global.XMLHttpRequest) {
replace(40);
}
}
}
} catch (b) {
}
t.set(attrs, read(t), true);
t.set(props, fn(t, props) + 1);
/** @type {Array} */
var tagNameArr = [];
self.map(function(storageKey, item) {
if (item.F) {
var value = t.get(storageKey);
if (void 0 != value) {
if (value != item.defaultValue) {
if ("boolean" == typeof value) {
value *= 1;
}
tagNameArr.push(item.F + "=" + jQuery("" + value));
}
}
}
});
tagNameArr.push("z=" + hook());
t.set(foo, tagNameArr.join("&"), true);
}
/**
* @param {Object} element
* @return {undefined}
*/
function setup(element) {
var req = done(element, third) || split() + "/collect";
var data = done(element, camelKey);
if (!data) {
if (element.get(modalInstance)) {
/** @type {string} */
data = "beacon";
}
}
if (data) {
var url = done(element, foo);
var which = element.get(first);
which = which || pdataCur;
if ("image" == data) {
send(req, url, which);
} else {
if (!("xhr" == data && request(req, url, which))) {
if (!("beacon" == data && register(req, url, which))) {
ready(req, url, which);
}
}
}
} else {
ready(req, done(element, foo), element.get(first));
}
element.set(first, pdataCur, true);
}
/**
* @param {(Node|string)} c
* @return {undefined}
*/
function end(c) {
var args = global.gaData;
if (args) {
if (args.expId) {
c.set(callee, args.expId);
}
if (args.expVar) {
c.set(prop, args.expVar);
}
}
}
/**
* @return {undefined}
*/
function which() {
if (global.navigator && "preview" == global.navigator.loadPurpose) {
throw "abort";
}
}
/**
* @param {(Node|string)} task
* @return {undefined}
*/
function build(task) {
var w = global.gaDevIds;
if (getType(w)) {
if (0 != w.length) {
task.set("&did", w.join(","), true);
}
}
}
/**
* @param {Node} r
* @return {undefined}
*/
function handleResponse(r) {
if (!r.get(n)) {
throw "abort";
}
}
/**
* @param {Object} el
* @return {undefined}
*/
function loop(el) {
var result = fn(el, instance);
if (500 <= result) {
replace(15);
}
var index = done(el, p);
if ("transaction" != index && "item" != index) {
index = fn(el, type);
/** @type {number} */
var pdataOld = (new Date).getTime();
var value = fn(el, subKey);
if (0 == value) {
el.set(subKey, pdataOld);
}
/** @type {number} */
value = Math.round(2 * (pdataOld - value) / 1E3);
if (0 < value) {
/** @type {number} */
index = Math.min(index + value, 20);
el.set(subKey, pdataOld);
}
if (0 >= index) {
throw "abort";
}
el.set(type, --index);
}
el.set(instance, ++result);
}
/**
* @param {string} name
* @param {Object} actual
* @param {Function} matcherFunction
* @param {number} opt_attributes
* @return {undefined}
*/
function expect(name, actual, matcherFunction, opt_attributes) {
/**
* @return {?}
*/
actual[name] = function() {
try {
return opt_attributes && replace(opt_attributes), matcherFunction.apply(this, arguments);
} catch (packageInfo) {
throw addClass("exc", name, packageInfo && packageInfo.name), packageInfo;
}
};
}
/**
* @return {?}
*/
function getFlashVersion() {
var xx139;
var v;
var codeSegments;
if ((codeSegments = (codeSegments = global.navigator) ? codeSegments.plugins : null) && codeSegments.length) {
/** @type {number} */
var i = 0;
for (;i < codeSegments.length && !v;i++) {
var c = codeSegments[i];
if (-1 < c.name.indexOf("Shockwave Flash")) {
v = c.description;
}
}
}
if (!v) {
try {
xx139 = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
v = xx139.GetVariable("$version");
} catch (g) {
}
}
if (!v) {
try {
xx139 = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
/** @type {string} */
v = "WIN 6,0,21,0";
/** @type {string} */
xx139.AllowScriptAccess = "always";
v = xx139.GetVariable("$version");
} catch (ca) {
}
}
if (!v) {
try {
xx139 = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
v = xx139.GetVariable("$version");
} catch (l) {
}
}
if (v) {
if (xx139 = v.match(/[\d]+/g)) {
if (3 <= xx139.length) {
v = xx139[0] + "." + xx139[1] + " r" + xx139[2];
}
}
}
return v || void 0;
}
/**
* @param {Object} arg
* @param {string} data
* @param {string} node
* @return {?}
*/
function insert(arg, data, node) {
if ("none" == data) {
/** @type {string} */
data = "";
}
/** @type {Array} */
var commits = [];
var codeSegments = $(arg);
/** @type {number} */
arg = "__utma" == arg ? 6 : 2;
/** @type {number} */
var i = 0;
for (;i < codeSegments.length;i++) {
var resolveValues = ("" + codeSegments[i]).split(".");
if (resolveValues.length >= arg) {
commits.push({
hash : resolveValues[0],
R : codeSegments[i],
O : resolveValues
});
}
}
return 0 == commits.length ? void 0 : 1 == commits.length ? commits[0] : isEmpty(data, commits) || (isEmpty(node, commits) || (isEmpty(null, commits) || commits[0]));
}
/**
* @param {string} value
* @param {Array} codeSegments
* @return {?}
*/
function isEmpty(value, codeSegments) {
var hash;
var s;
if (null == value) {
/** @type {number} */
hash = s = 1;
} else {
hash = escape(value);
s = escape(fix(value, ".") ? value.substring(1) : "." + value);
}
/** @type {number} */
var i = 0;
for (;i < codeSegments.length;i++) {
if (codeSegments[i].hash == hash || codeSegments[i].hash == s) {
return codeSegments[i];
}
}
}
/**
* @param {Object} context
* @return {?}
*/
function select(context) {
context = context.get(hash);
var key = formatDate(context, 0);
return "_ga=1." + jQuery(key + "." + context);
}
/**
* @param {Object} value
* @param {number} outstandingDataSize
* @return {?}
*/
function formatDate(value, outstandingDataSize) {
/** @type {Date} */
var time = new Date;
/** @type {(Navigator|null)} */
var i = global.navigator;
/** @type {(Array|PluginArray)} */
var codeSegments = i.plugins || [];
/** @type {Array} */
time = [value, i.userAgent, time.getTimezoneOffset(), time.getYear(), time.getDate(), time.getHours(), time.getMinutes() + outstandingDataSize];
/** @type {number} */
i = 0;
for (;i < codeSegments.length;++i) {
time.push(codeSegments[i].description);
}
return escape(time.join("."));
}
/**
* @param {Array} value
* @param {string} f
* @return {?}
*/
function test(value, f) {
if (f == doc.location.hostname) {
return false;
}
/** @type {number} */
var i = 0;
for (;i < value.length;i++) {
if (value[i] instanceof RegExp) {
if (value[i].test(f)) {
return true;
}
} else {
if (0 <= f.indexOf(value[i])) {
return true;
}
}
}
return false;
}
/**
* @param {string} str
* @return {?}
*/
function endsWith(str) {
return 0 <= str.indexOf(".") || 0 <= str.indexOf(":");
}
/**
* @param {string} str
* @return {?}
*/
function escape(str) {
/** @type {number} */
var w = 1;
/** @type {number} */
var chunk = 0;
var offset;
if (str) {
/** @type {number} */
w = 0;
/** @type {number} */
offset = str.length - 1;
for (;0 <= offset;offset--) {
chunk = str.charCodeAt(offset);
w = (w << 6 & 268435455) + chunk + (chunk << 14);
/** @type {number} */
chunk = w & 266338304;
w = 0 != chunk ? w ^ chunk >> 21 : w;
}
}
return w;
}
/**
* @param {Array} w
* @return {undefined}
*/
var Rect = function(w) {
this.w = w || [];
};
/**
* @param {?} key
* @return {undefined}
*/
Rect.prototype.set = function(key) {
/** @type {boolean} */
this.w[key] = true;
};
/**
* @return {?}
*/
Rect.prototype.encode = function() {
/** @type {Array} */
var codeSegments = [];
/** @type {number} */
var i = 0;
for (;i < this.w.length;i++) {
if (this.w[i]) {
codeSegments[Math.floor(i / 6)] ^= 1 << i % 6;
}
}
/** @type {number} */
i = 0;
for (;i < codeSegments.length;i++) {
/** @type {string} */
codeSegments[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(codeSegments[i] || 0);
}
return codeSegments.join("") + "~";
};
var map = new Rect;
/**
* @param {Object} test
* @param {number} props
* @return {undefined}
*/
var reset = function(test, props) {
var r = new Rect(find(test));
r.set(props);
test.set(ast, r.w);
};
/**
* @param {Object} a
* @return {?}
*/
var read = function(a) {
a = find(a);
a = new Rect(a);
var a1 = map.w.slice();
/** @type {number} */
var i = 0;
for (;i < a.w.length;i++) {
a1[i] = a1[i] || a.w[i];
}
return(new Rect(a1)).encode();
};
/**
* @param {Array} test
* @return {?}
*/
var find = function(test) {
test = test.get(ast);
if (!getType(test)) {
/** @type {Array} */
test = [];
}
return test;
};
/**
* @param {Array} obj
* @return {?}
*/
var isFunction = function(obj) {
return "function" == typeof obj;
};
/**
* @param {Array} o
* @return {?}
*/
var getType = function(o) {
return "[object Array]" == Object.prototype.toString.call(Object(o));
};
/**
* @param {(Array|string)} object
* @return {?}
*/
var toString = function(object) {
return void 0 != object && -1 < (object.constructor + "").indexOf("String");
};
/**
* @param {string} url
* @param {string} value
* @return {?}
*/
var fix = function(url, value) {
return 0 == url.indexOf(value);
};
/**
* @param {boolean} b
* @return {?}
*/
var extend = function(b) {
return b ? b.replace(/^[\s\xa0]+|[\s\xa0]+$/g, "") : "";
};
/**
* @param {string} name
* @return {?}
*/
var resolve = function(name) {
/** @type {Element} */
var value = doc.createElement("img");
/** @type {number} */
value.width = 1;
/** @type {number} */
value.height = 1;
/** @type {string} */
value.src = name;
return value;
};
/**
* @return {undefined}
*/
var pdataCur = function() {
};
/**
* @param {string} expression
* @return {?}
*/
var jQuery = function(expression) {
if (encodeURIComponent instanceof Function) {
return encodeURIComponent(expression);
}
replace(28);
return expression;
};
/**
* @param {HTMLElement} element
* @param {string} event
* @param {Function} fn
* @param {boolean} recurring
* @return {undefined}
*/
var on = function(element, event, fn, recurring) {
try {
if (element.addEventListener) {
element.addEventListener(event, fn, !!recurring);
} else {
if (element.attachEvent) {
element.attachEvent("on" + event, fn);
}
}
} catch (e) {
replace(27);
}
};
/**
* @param {string} path
* @param {string} uri
* @return {undefined}
*/
var loadScript = function(path, uri) {
if (path) {
/** @type {Element} */
var el = doc.createElement("script");
/** @type {string} */
el.type = "text/javascript";
/** @type {boolean} */
el.async = true;
/** @type {string} */
el.src = path;
if (uri) {
/** @type {string} */
el.id = uri;
}
var insertAt = doc.getElementsByTagName("script")[0];
insertAt.parentNode.insertBefore(el, insertAt);
}
};
/**
* @return {?}
*/
var slice = function() {
return "https:" == doc.location.protocol;
};
/**
* @return {?}
*/
var update = function() {
/** @type {string} */
var part = "" + doc.location.hostname;
return 0 == part.indexOf("www.") ? part.substring(4) : part;
};
/**
* @param {string} c
* @return {?}
*/
var create = function(c) {
/** @type {string} */
var path = doc.referrer;
if (/^https?:\/\//i.test(path)) {
if (c) {
return path;
}
/** @type {string} */
c = "//" + doc.location.hostname;
/** @type {number} */
var n = path.indexOf(c);
if (5 == n || 6 == n) {
if (c = path.charAt(n + c.length), "/" == c || ("?" == c || ("" == c || ":" == c))) {
return;
}
}
return path;
}
};
/**
* @param {Array} defaults
* @param {Array} input
* @return {?}
*/
var apply = function(defaults, input) {
if (1 == input.length && (null != input[0] && "object" === typeof input[0])) {
return input[0];
}
var a = {};
/** @type {number} */
var padLength = Math.min(defaults.length + 1, input.length);
/** @type {number} */
var i = 0;
for (;i < padLength;i++) {
if ("object" === typeof input[i]) {
var key;
for (key in input[i]) {
if (input[i].hasOwnProperty(key)) {
a[key] = input[i][key];
}
}
break;
} else {
if (i < defaults.length) {
a[defaults[i]] = input[i];
}
}
}
return a;
};
/**
* @return {undefined}
*/
var Map = function() {
/** @type {Array} */
this.keys = [];
this.values = {};
this.m = {};
};
/**
* @param {?} key
* @param {Object} value
* @param {boolean} deepDataAndEvents
* @return {undefined}
*/
Map.prototype.set = function(key, value, deepDataAndEvents) {
this.keys.push(key);
if (deepDataAndEvents) {
/** @type {Object} */
this.m[":" + key] = value;
} else {
/** @type {Object} */
this.values[":" + key] = value;
}
};
/**
* @param {?} key
* @return {?}
*/
Map.prototype.get = function(key) {
return this.m.hasOwnProperty(":" + key) ? this.m[":" + key] : this.values[":" + key];
};
/**
* @param {Function} callback
* @return {undefined}
*/
Map.prototype.map = function(callback) {
/** @type {number} */
var i = 0;
for (;i < this.keys.length;i++) {
var key = this.keys[i];
var values = this.get(key);
if (values) {
callback(key, values);
}
}
};
/** @type {Window} */
var global = window;
/** @type {HTMLDocument} */
var doc = document;
/**
* @return {?}
*/
var parseCookies = function() {
/** @type {string} */
var c = global.navigator.userAgent + (doc.cookie ? doc.cookie : "") + (doc.referrer ? doc.referrer : "");
/** @type {number} */
var cl = c.length;
/** @type {number} */
var cnl = global.history.length;
for (;0 < cnl;) {
c += cnl-- ^ cl++;
}
return escape(c);
};
/**
* @param {Function} dataAndEvents
* @return {?}
*/
var hasClass = function(dataAndEvents) {
var previousDefine = global._gaUserPrefs;
if (previousDefine && (previousDefine.ioo && previousDefine.ioo()) || dataAndEvents && true === global["ga-disable-" + dataAndEvents]) {
return true;
}
try {
var previousKey = global.external;
if (previousKey && (previousKey._gaUserPrefs && "oo" == previousKey._gaUserPrefs)) {
return true;
}
} catch (d) {
}
return false;
};
/**
* @param {string} obj
* @return {?}
*/
var $ = function(obj) {
/** @type {Array} */
var ret = [];
/** @type {Array.<string>} */
var codeSegments = doc.cookie.split(";");
/** @type {RegExp} */
obj = new RegExp("^\\s*" + obj + "=\\s*(.*?)\\s*$");
/** @type {number} */
var i = 0;
for (;i < codeSegments.length;i++) {
/** @type {(Array.<string>|null)} */
var names = codeSegments[i].match(obj);
if (names) {
ret.push(names[1]);
}
}
return ret;
};
/**
* @param {Object} input
* @param {string} from
* @param {string} c
* @param {string} value
* @param {boolean} node
* @param {number} callback
* @return {?}
*/
var remove = function(input, from, c, value, node, callback) {
/** @type {boolean} */
node = hasClass(node) ? false : rchecked.test(doc.location.hostname) || "/" == c && spaceRe.test(value) ? false : true;
if (!node) {
return false;
}
if (from) {
if (1200 < from.length) {
from = from.substring(0, 1200);
replace(24);
}
}
/** @type {string} */
c = input + "=" + from + "; path=" + c + "; ";
if (callback) {
c += "expires=" + (new Date((new Date).getTime() + callback)).toGMTString() + "; ";
}
if (value) {
if ("none" != value) {
c += "domain=" + value + ";";
}
}
/** @type {string} */
value = doc.cookie;
/** @type {string} */
doc.cookie = c;
if (!(value = value != doc.cookie)) {
a: {
input = $(input);
/** @type {number} */
value = 0;
for (;value < input.length;value++) {
if (from == input[value]) {
/** @type {boolean} */
value = true;
break a;
}
}
/** @type {boolean} */
value = false;
}
}
return value;
};
/**
* @param {string} selector
* @return {?}
*/
var parse = function(selector) {
return jQuery(selector).replace(/\(/g, "%28").replace(/\)/g, "%29");
};
/** @type {RegExp} */
var spaceRe = /^(www\.)?google(\.com?)?(\.[a-z]{2})?$/;
/** @type {RegExp} */
var rchecked = /(^|\.)doubleclick\.net$/i;
/**
* @return {?}
*/
var split = function() {
return(elements || slice() ? "https:" : "http:") + "//www.google-analytics.com";
};
/**
* @param {string} message
* @return {undefined}
*/
var debug = function(message) {
/** @type {string} */
this.name = "len";
/** @type {string} */
this.message = message + "-8192";
};
/**
* @param {string} req
* @param {string} url
* @param {Function} callback
* @return {undefined}
*/
var ready = function(req, url, callback) {
callback = callback || pdataCur;
if (2036 >= url.length) {
send(req, url, callback);
} else {
if (8192 >= url.length) {
if (!register(req, url, callback)) {
if (!request(req, url, callback)) {
send(req, url, callback);
}
}
} else {
throw addClass("len", url.length), new debug(url.length);
}
}
};
/**
* @param {string} message
* @param {string} url
* @param {Function} callback
* @return {undefined}
*/
var send = function(message, url, callback) {
var xdr = resolve(message + "?" + url);
/** @type {function (): undefined} */
xdr.onload = xdr.onerror = function() {
/** @type {null} */
xdr.onload = null;
/** @type {null} */
xdr.onerror = null;
callback();
};
};
/**
* @param {string} path
* @param {string} query
* @param {Function} callback
* @return {?}
*/
var request = function(path, query, callback) {
var XHR = global.XMLHttpRequest;
if (!XHR) {
return false;
}
/** @type {XMLHttpRequest} */
var xhr = new XHR;
if (!("withCredentials" in xhr)) {
return false;
}
xhr.open("POST", path, true);
/** @type {boolean} */
xhr.withCredentials = true;
xhr.setRequestHeader("Content-Type", "text/plain");
/**
* @return {undefined}
*/
xhr.onreadystatechange = function() {
if (4 == xhr.readyState) {
callback();
/** @type {null} */
xhr = null;
}
};
xhr.send(query);
return true;
};
/**
* @param {string} req
* @param {string} urls
* @param {Function} callback
* @return {?}
*/
var register = function(req, urls, callback) {
return global.navigator.sendBeacon ? global.navigator.sendBeacon(req, urls) ? (callback(), true) : false : false;
};
/**
* @param {(Array|string)} value
* @param {string} e
* @param {string} className
* @return {undefined}
*/
var addClass = function(value, e, className) {
if (!(1 <= 100 * Math.random())) {
if (!hasClass("?")) {
/** @type {Array} */
value = ["t=error", "_e=" + value, "_v=j39", "sr=1"];
if (e) {
value.push("_f=" + e);
}
if (className) {
value.push("_m=" + jQuery(className.substring(0, 100)));
}
value.push("aip=1");
value.push("z=" + $timeout());
send(split() + "/collect", value.join("&"), pdataCur);
}
}
};
/**
* @return {undefined}
*/
var Dictionary = function() {
/** @type {Array} */
this.M = [];
};
/**
* @param {?} set
* @return {undefined}
*/
Dictionary.prototype.add = function(set) {
this.M.push(set);
};
/**
* @param {HTMLElement} args
* @return {undefined}
*/
Dictionary.prototype.D = function(args) {
try {
/** @type {number} */
var t = 0;
for (;t < this.M.length;t++) {
var func = args.get(this.M[t]);
if (func) {
if (isFunction(func)) {
func.call(global, args);
}
}
}
} catch (d) {
}
t = args.get(first);
if (t != pdataCur) {
if (isFunction(t)) {
args.set(first, pdataCur, true);
setTimeout(t, 10);
}
}
};
/**
* @return {?}
*/
var randInt = function() {
return Math.round(2147483647 * Math.random());
};
/**
* @return {?}
*/
var hook = function() {
try {
/** @type {Uint32Array} */
var _rnds = new Uint32Array(1);
global.crypto.getRandomValues(_rnds);
return _rnds[0] & 2147483647;
} catch (b) {
return randInt();
}
};
/** @type {function (): ?} */
var $timeout = randInt;
/**
* @return {undefined}
*/
var Controller = function() {
this.data = new Map;
};
var self = new Map;
/** @type {Array} */
var codeSegments = [];
/**
* @param {?} key
* @return {?}
*/
Controller.prototype.get = function(key) {
var value = has(key);
var camelKey = this.data.get(key);
if (value) {
if (void 0 == camelKey) {
camelKey = isFunction(value.defaultValue) ? value.defaultValue() : value.defaultValue;
}
}
return value && value.Z ? value.Z(this, key, camelKey) : camelKey;
};
/**
* @param {Object} obj
* @param {?} key
* @return {?}
*/
var done = function(obj, key) {
var id = obj.get(key);
return void 0 == id ? "" : "" + id;
};
/**
* @param {Object} a
* @param {?} key
* @return {?}
*/
var fn = function(a, key) {
var data = a.get(key);
return void 0 == data || "" === data ? 0 : 1 * data;
};
/**
* @param {?} key
* @param {Object} value
* @param {boolean} deepDataAndEvents
* @return {undefined}
*/
Controller.prototype.set = function(key, value, deepDataAndEvents) {
if (key) {
if ("object" == typeof key) {
var p;
for (p in key) {
if (key.hasOwnProperty(p)) {
setValue(this, p, key[p], deepDataAndEvents);
}
}
} else {
setValue(this, key, value, deepDataAndEvents);
}
}
};
/**
* @param {Node} d
* @param {?} props
* @param {Object} value
* @param {boolean} deepDataAndEvents
* @return {undefined}
*/
var setValue = function(d, props, value, deepDataAndEvents) {
if (void 0 != value) {
switch(props) {
case n:
arrayRegex.test(value);
}
}
var b = has(props);
if (b && b.o) {
b.o(d, props, value, deepDataAndEvents);
} else {
d.data.set(props, value, deepDataAndEvents);
}
};
/**
* @param {string} name
* @param {Function} value
* @param {?} defaultValue
* @param {?} aBase
* @param {string} o
* @return {undefined}
*/
var Value = function(name, value, defaultValue, aBase, o) {
/** @type {string} */
this.name = name;
/** @type {Function} */
this.F = value;
this.Z = aBase;
/** @type {string} */
this.o = o;
this.defaultValue = defaultValue;
};
/**
* @param {?} key
* @return {?}
*/
var has = function(key) {
var camelKey = self.get(key);
if (!camelKey) {
/** @type {number} */
var i = 0;
for (;i < codeSegments.length;i++) {
var rule = codeSegments[i];
var match = rule[0].exec(key);
if (match) {
camelKey = rule[1](match);
self.set(camelKey.name, camelKey);
break;
}
}
}
return camelKey;
};
/**
* @param {?} o
* @return {?}
*/
var compileNode = function(o) {
var error;
self.map(function(dataAndEvents, err) {
if (err.F == o) {
/** @type {string} */
error = err;
}
});
return error && error.name;
};
/**
* @param {string} name
* @param {string} obj
* @param {Object} aValue
* @param {Object} event
* @param {Object} value
* @return {?}
*/
var callback = function(name, obj, aValue, event, value) {
name = new Value(name, obj, aValue, event, value);
self.set(name.name, name);
return name.name;
};
/**
* @param {string} expr
* @param {Function} event
* @return {undefined}
*/
var filter = function(expr, event) {
codeSegments.push([new RegExp("^" + expr + "$"), event]);
};
/**
* @param {string} name
* @param {string} opt_attributes
* @param {Object} value
* @return {?}
*/
var require = function(name, opt_attributes, value) {
return callback(name, opt_attributes, value, void 0, pdataOld);
};
/**
* @return {undefined}
*/
var pdataOld = function() {
};
var namespace = toString(window.GoogleAnalyticsObject) && extend(window.GoogleAnalyticsObject) || "ga";
/** @type {boolean} */
var elements = false;
var value = callback("_br");
var child = require("apiVersion", "v");
var node = require("clientVersion", "_v");
callback("anonymizeIp", "aip");
var serverAttrs = callback("adSenseId", "a");
var p = callback("hitType", "t");
var first = callback("hitCallback");
var foo = callback("hitPayload");
callback("nonInteraction", "ni");
callback("currencyCode", "cu");
callback("dataSource", "ds");
var modalInstance = callback("useBeacon", void 0, false);
var camelKey = callback("transport");
callback("sessionControl", "sc", "");
callback("sessionGroup", "sg");
callback("queueTime", "qt");
var props = callback("_s", "_s");
callback("screenName", "cd");
var key = callback("location", "dl", "");
var parentNode = callback("referrer", "dr");
var result = callback("page", "dp", "");
callback("hostname", "dh");
var properties = callback("language", "ul");
var KEY = callback("encoding", "de");
callback("title", "dt", function() {
return doc.title || void 0;
});
filter("contentGroup([0-9]+)", function(dataAndEvents) {
return new Value(dataAndEvents[0], "cg" + dataAndEvents[1]);
});
var methods = callback("screenColors", "sd");
var key2 = callback("screenResolution", "sr");
var expireKey = callback("viewportSize", "vp");
var actualKey = callback("javaEnabled", "je");
var cacheKey = callback("flashVersion", "fl");
callback("campaignId", "ci");
callback("campaignName", "cn");
callback("campaignSource", "cs");
callback("campaignMedium", "cm");
callback("campaignKeyword", "ck");
callback("campaignContent", "cc");
var event = callback("eventCategory", "ec");
var hosts = callback("eventAction", "ea");
var res = callback("eventLabel", "el");
var ret = callback("eventValue", "ev");
var new_value = callback("socialNetwork", "sn");
var social = callback("socialAction", "sa");
var perc_ind = callback("socialTarget", "st");
var index = callback("l1", "plt");
var val = callback("l2", "pdt");
var token = callback("l3", "dns");
var className = callback("l4", "rrt");
var entry = callback("l5", "srt");
var target = callback("l6", "tcp");
var keyName = callback("l7", "dit");
var param = callback("l8", "clt");
var range = callback("timingCategory", "utc");
var timing = callback("timingVar", "utv");
var timingLabel = callback("timingLabel", "utl");
var timingValue = callback("timingValue", "utt");
callback("appName", "an");
callback("appVersion", "av", "");
callback("appId", "aid", "");
callback("appInstallerId", "aiid", "");
callback("exDescription", "exd");
callback("exFatal", "exf");
var callee = callback("expId", "xid");
var prop = callback("expVar", "xvar");
var current = callback("_utma", "_utma");
var length = callback("_utmz", "_utmz");
var valueKey = callback("_utmht", "_utmht");
var instance = callback("_hc", void 0, 0);
var subKey = callback("_ti", void 0, 0);
var type = callback("_to", void 0, 20);
filter("dimension([0-9]+)", function(dataAndEvents) {
return new Value(dataAndEvents[0], "cd" + dataAndEvents[1]);
});
filter("metric([0-9]+)", function(dataAndEvents) {
return new Value(dataAndEvents[0], "cm" + dataAndEvents[1]);
});
callback("linkerParam", void 0, void 0, select, pdataOld);
var attrs = callback("usage", "_u");
var ast = callback("_um");
callback("forceSSL", void 0, void 0, function() {
return elements;
}, function(dataAndEvents, deepDataAndEvents, ignoreMethodDoesntExist) {
replace(34);
/** @type {boolean} */
elements = !!ignoreMethodDoesntExist;
});
var U = callback("_j1", "jid");
filter("\\&(.*)", function(matches) {
var pos = new Value(matches[0], matches[1]);
var storageKey = compileNode(matches[0].substring(1));
if (storageKey) {
/**
* @param {Node} t
* @return {?}
*/
pos.Z = function(t) {
return t.get(storageKey);
};
/**
* @param {(Node|string)} storage
* @param {?} options
* @param {Object} value
* @param {boolean} deepDataAndEvents
* @return {undefined}
*/
pos.o = function(storage, options, value, deepDataAndEvents) {
storage.set(storageKey, value, deepDataAndEvents);
};
pos.F = void 0;
}
return pos;
});
var j = require("_oot");
var arg = callback("previewTask");
var prefix = callback("checkProtocolTask");
var keyname = callback("validationTask");
var later = callback("checkStorageTask");
var input = callback("historyImportTask");
var base = callback("samplerTask");
var loc = callback("_rlt");
var storageKey = callback("buildHitTask");
var expr = callback("sendHitTask");
var gui = callback("ceTask");
var progress = callback("devIdTask");
var uid = callback("timingTask");
var win = callback("displayFeaturesTask");
var code = require("name");
var hash = require("clientId", "cid");
var pos = callback("userId", "uid");
var n = require("trackingId", "tid");
var item = require("cookieName", void 0, "_ga");
var name = require("cookieDomain");
var url = require("cookiePath", void 0, "/");
var path = require("cookieExpires", void 0, 63072E3);
var number = require("legacyCookieDomain");
var cur = require("legacyHistoryImport", void 0, true);
var r = require("storage", void 0, "cookie");
var second = require("allowLinker", void 0, false);
var k = require("allowAnchor", void 0, true);
var id = require("sampleRate", "sf", 100);
var i = require("siteSpeedSampleRate", void 0, 1);
var command = require("alwaysSendReferrer", void 0, false);
var third = callback("transportUrl");
var elem = callback("_r", "_r");
/**
* @param {boolean} name
* @param {?} b
* @param {number} showFull
* @return {undefined}
*/
var standard = function(name, b, showFull) {
/** @type {number} */
this.V = 1E4;
/** @type {boolean} */
this.fa = name;
/** @type {boolean} */
this.$ = false;
this.B = b;
this.ea = showFull || 1;
};
/**
* @param {Object} self
* @param {Object} container
* @return {?}
*/
var run = function(self, container) {
var dataIndex;
if (self.fa && self.$) {
return 0;
}
/** @type {boolean} */
self.$ = true;
if (container) {
if (self.B && fn(container, self.B)) {
return fn(container, self.B);
}
if (0 == container.get(i)) {
return 0;
}
}
if (0 == self.V) {
return 0;
}
if (void 0 === dataIndex) {
dataIndex = hook();
}
return 0 == dataIndex % self.V ? Math.floor(dataIndex / self.V) % self.ea + 1 : 0;
};
var c = new standard(true, value, 7);
/**
* @param {string} name
* @return {undefined}
*/
var process = function(name) {
if (!slice() && !elements) {
var key = run(c, name);
if (key && !(!global.navigator.sendBeacon && (4 <= key && 6 >= key))) {
/** @type {number} */
var traverse = (new Date).getHours();
/** @type {string} */
var e = [hook(), hook(), hook()].join(".");
/** @type {string} */
name = (3 == key || 5 == key ? "https:" : "http:") + "//www.google-analytics.com/collect?z=br.";
name += [key, "A", traverse, e].join(".");
/** @type {string} */
var total = 1 != key % 3 ? "https:" : "http:";
/** @type {string} */
total = total + "//www.google-analytics.com/collect?z=br.";
/** @type {string} */
total = total + [key, "B", traverse, e].join(".");
if (7 == key) {
/** @type {string} */
total = total.replace("//www.", "//ssl.");
}
/**
* @return {undefined}
*/
traverse = function() {
if (4 <= key && 6 >= key) {
global.navigator.sendBeacon(total, "");
} else {
resolve(total);
}
};
if (hook() % 2) {
resolve(name);
traverse();
} else {
traverse();
resolve(name);
}
}
}
};
/**
* @param {Object} e
* @param {Function} callback
* @return {undefined}
*/
var next = function(e, callback) {
/** @type {number} */
var actual = Math.min(fn(e, i), 100);
if (!(escape(done(e, hash)) % 100 >= actual) && (actual = {}, isDate(actual) || deepEqual(actual))) {
var actualValue = actual[index];
if (!(void 0 == actualValue)) {
if (!(Infinity == actualValue)) {
if (!isNaN(actualValue)) {
if (0 < actualValue) {
indexOf(actual, token);
indexOf(actual, target);
indexOf(actual, entry);
indexOf(actual, val);
indexOf(actual, className);
indexOf(actual, keyName);
indexOf(actual, param);
callback(actual);
} else {
on(global, "load", function() {
next(e, callback);
}, false);
}
}
}
}
}
};
/**
* @param {number} obj
* @return {?}
*/
var isDate = function(obj) {
var t = global.performance || global.webkitPerformance;
t = t && t.timing;
if (!t) {
return false;
}
var c = t.navigationStart;
if (0 == c) {
return false;
}
/** @type {number} */
obj[index] = t.loadEventStart - c;
/** @type {number} */
obj[token] = t.domainLookupEnd - t.domainLookupStart;
/** @type {number} */
obj[target] = t.connectEnd - t.connectStart;
/** @type {number} */
obj[entry] = t.responseStart - t.requestStart;
/** @type {number} */
obj[val] = t.responseEnd - t.responseStart;
/** @type {number} */
obj[className] = t.fetchStart - c;
/** @type {number} */
obj[keyName] = t.domInteractive - c;
/** @type {number} */
obj[param] = t.domContentLoadedEventStart - c;
return true;
};
/**
* @param {number} actual
* @return {?}
*/
var deepEqual = function(actual) {
if (global.top != global) {
return false;
}
var context = global.external;
var obj = context && context.onloadT;
if (context) {
if (!context.isValidLoadTime) {
obj = void 0;
}
}
if (2147483648 < obj) {
obj = void 0;
}
if (0 < obj) {
context.setPageReadyTime();
}
if (void 0 == obj) {
return false;
}
actual[index] = obj;
return true;
};
/**
* @param {number} arr
* @param {?} item
* @return {undefined}
*/
var indexOf = function(arr, item) {
var val = arr[item];
if (isNaN(val) || (Infinity == val || 0 > val)) {
arr[item] = void 0;
}
};
/**
* @param {Object} self
* @return {?}
*/
var validate = function(self) {
return function(e) {
if (!("pageview" != e.get(p))) {
if (!self.I) {
/** @type {boolean} */
self.I = true;
next(e, function(funcToCall) {
self.send("timing", funcToCall);
});
}
}
};
};
/** @type {boolean} */
var hc = false;
/**
* @param {Object} e
* @return {undefined}
*/
var start = function(e) {
if ("cookie" == done(e, r)) {
var obj = done(e, item);
var start = onload(e);
var position = normalize(done(e, url));
var pdataOld = match(done(e, name));
/** @type {number} */
var restoreScript = 1E3 * fn(e, path);
var parser = done(e, n);
if ("auto" != pdataOld) {
if (remove(obj, start, position, pdataOld, parser, restoreScript)) {
/** @type {boolean} */
hc = true;
}
} else {
replace(32);
var index;
a: {
/** @type {Array} */
start = [];
pdataOld = update().split(".");
if (4 == pdataOld.length && (index = pdataOld[pdataOld.length - 1], parseInt(index, 10) == index)) {
/** @type {Array} */
index = ["none"];
break a;
}
/** @type {number} */
index = pdataOld.length - 2;
for (;0 <= index;index--) {
start.push(pdataOld.slice(index).join("."));
}
start.push("none");
/** @type {Array} */
index = start;
}
/** @type {number} */
var l = 0;
for (;l < index.length;l++) {
if (pdataOld = index[l], e.data.set(name, pdataOld), start = onload(e), remove(obj, start, position, pdataOld, parser, restoreScript)) {
/** @type {boolean} */
hc = true;
return;
}
}
e.data.set(name, "auto");
}
}
};
/**
* @param {Object} e
* @return {undefined}
*/
var cb = function(e) {
if ("cookie" == done(e, r) && (!hc && (start(e), !hc))) {
throw "abort";
}
};
/**
* @param {Object} element
* @return {undefined}
*/
var complete = function(element) {
if (element.get(cur)) {
var node = done(element, name);
var camelKey = done(element, number) || update();
var data = insert("__utma", camelKey, node);
if (data) {
replace(19);
element.set(valueKey, (new Date).getTime(), true);
element.set(current, data.R);
if (node = insert("__utmz", camelKey, node)) {
if (data.hash == node.hash) {
element.set(length, node.R);
}
}
}
}
};
/**
* @param {number} err
* @return {?}
*/
var onload = function(err) {
var result = parse(done(err, hash));
var msg = assert(done(err, name));
err = stringify(done(err, url));
if (1 < err) {
msg += "-" + err;
}
return["GA1", msg, result].join(".");
};
/**
* @param {Array} s
* @param {?} obj
* @param {number} i
* @return {?}
*/
var log = function(s, obj, i) {
/** @type {Array} */
var matched = [];
/** @type {Array} */
var eventPath = [];
var level;
/** @type {number} */
var index = 0;
for (;index < s.length;index++) {
var cur = s[index];
if (cur.H[i] == obj) {
matched.push(cur);
} else {
if (void 0 == level || cur.H[i] < level) {
/** @type {Array} */
eventPath = [cur];
level = cur.H[i];
} else {
if (cur.H[i] == level) {
eventPath.push(cur);
}
}
}
}
return 0 < matched.length ? matched : eventPath;
};
/**
* @param {string} selector
* @return {?}
*/
var match = function(selector) {
return 0 == selector.indexOf(".") ? selector.substr(1) : selector;
};
/**
* @param {string} expr
* @return {?}
*/
var assert = function(expr) {
return match(expr).split(".").length;
};
/**
* @param {string} path
* @return {?}
*/
var normalize = function(path) {
if (!path) {
return "/";
}
if (1 < path.length) {
if (path.lastIndexOf("/") == path.length - 1) {
path = path.substr(0, path.length - 1);
}
}
if (0 != path.indexOf("/")) {
/** @type {string} */
path = "/" + path;
}
return path;
};
/**
* @param {string} prefix
* @return {?}
*/
var stringify = function(prefix) {
prefix = normalize(prefix);
return "/" == prefix ? 1 : prefix.split("/").length;
};
/** @type {RegExp} */
var description = new RegExp(/^https?:\/\/([^\/:]+)/);
/** @type {RegExp} */
var reName = /(.*)([?&#])(?:_ga=[^&#]*)(?:&?)(.*)/;
/**
* @param {Object} opt_target
* @return {undefined}
*/
var udataCur = function(opt_target) {
replace(48);
/** @type {Object} */
this.target = opt_target;
/** @type {boolean} */
this.T = false;
};
/**
* @param {Object} arg
* @param {string} i
* @return {?}
*/
udataCur.prototype.ca = function(arg, i) {
if (arg.tagName) {
if ("a" == arg.tagName.toLowerCase()) {
if (arg.href) {
arg.href = func(this, arg.href, i);
}
return;
}
if ("form" == arg.tagName.toLowerCase()) {
return render(this, arg);
}
}
if ("string" == typeof arg) {
return func(this, arg, i);
}
};
/**
* @param {(Object|string)} v
* @param {string} fn
* @param {string} i
* @return {?}
*/
var func = function(v, fn, i) {
/** @type {(Array.<string>|null)} */
var match = reName.exec(fn);
if (match) {
if (3 <= match.length) {
/** @type {string} */
fn = match[1] + (match[3] ? match[2] + match[3] : "");
}
}
v = v.target.get("linkerParam");
var e = fn.indexOf("?");
match = fn.indexOf("#");
if (i) {
fn += (-1 == match ? "#" : "&") + v;
} else {
/** @type {string} */
i = -1 == e ? "?" : "&";
fn = -1 == match ? fn + (i + v) : fn.substring(0, match) + i + v + fn.substring(match);
}
return fn;
};
/**
* @param {(Object|string)} self
* @param {Object} target
* @return {undefined}
*/
var render = function(self, target) {
if (target && target.action) {
var initialValue = self.target.get("linkerParam").split("=")[1];
if ("get" == target.method.toLowerCase()) {
var input = target.childNodes || [];
/** @type {number} */
var i = 0;
for (;i < input.length;i++) {
if ("_ga" == input[i].name) {
input[i].setAttribute("value", initialValue);
return;
}
}
/** @type {Element} */
input = doc.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "_ga");
input.setAttribute("value", initialValue);
target.appendChild(input);
} else {
if ("post" == target.method.toLowerCase()) {
target.action = func(self, target.action);
}
}
}
};
/**
* @param {Array} context
* @param {string} callback
* @param {Function} handler
* @return {undefined}
*/
udataCur.prototype.S = function(context, callback, handler) {
/**
* @param {Object} ev
* @return {undefined}
*/
function load(ev) {
try {
ev = ev || global.event;
var node;
a: {
var n = ev.target || ev.srcElement;
/** @type {number} */
ev = 100;
for (;n && 0 < ev;) {
if (n.href && n.nodeName.match(/^a(?:rea)?$/i)) {
node = n;
break a;
}
n = n.parentNode;
ev--;
}
node = {};
}
if ("http:" == node.protocol || "https:" == node.protocol) {
if (test(context, node.hostname || "")) {
if (node.href) {
node.href = func(item, node.href, callback);
}
}
}
} catch (w) {
replace(26);
}
}
var item = this;
if (!this.T) {
/** @type {boolean} */
this.T = true;
on(doc, "mousedown", load, false);
on(doc, "keyup", load, false);
}
if (handler) {
/**
* @param {Object} e
* @return {undefined}
*/
handler = function(e) {
e = e || global.event;
if ((e = e.target || e.srcElement) && e.action) {
var spec = e.action.match(description);
if (spec) {
if (test(context, spec[1])) {
render(item, e);
}
}
}
};
/** @type {number} */
var i = 0;
for (;i < doc.forms.length;i++) {
on(doc.forms[i], "submit", handler);
}
}
};
/**
* @param {Object} src
* @param {string} qualifier
* @param {string} vec0
* @return {undefined}
*/
var add = function(src, qualifier, vec0) {
this.U = U;
/** @type {string} */
this.aa = qualifier;
if (!(qualifier = vec0)) {
/** @type {string} */
qualifier = (qualifier = done(src, code)) && "t0" != qualifier ? isSimple.test(qualifier) ? "_gat_" + parse(done(src, n)) : "_gat_" + parse(qualifier) : "_gat";
}
/** @type {string} */
this.Y = qualifier;
};
/**
* @param {Object} type
* @param {HTMLElement} text
* @return {undefined}
*/
var save = function(type, text) {
var fn = text.get(storageKey);
text.set(storageKey, function(elem) {
hide(type, elem);
var matched = fn(elem);
click(type, elem);
return matched;
});
var parse = text.get(expr);
text.set(expr, function(data) {
var o = parse(data);
onSuccess(type, data);
return o;
});
};
/**
* @param {Object} config
* @param {Object} e
* @return {undefined}
*/
var hide = function(config, e) {
if (!e.get(config.U)) {
if ("1" == $(config.Y)[0]) {
e.set(config.U, "", true);
} else {
e.set(config.U, "" + $timeout(), true);
}
}
};
/**
* @param {Object} pos
* @param {Object} element
* @return {undefined}
*/
var click = function(pos, element) {
if (element.get(pos.U)) {
remove(pos.Y, "1", element.get(url), element.get(name), element.get(n), 6E5);
}
};
/**
* @param {Object} event
* @param {Object} t
* @return {undefined}
*/
var onSuccess = function(event, t) {
if (t.get(event.U)) {
var agent = new Map;
/**
* @param {?} key
* @return {undefined}
*/
var f = function(key) {
if (has(key).F) {
agent.set(has(key).F, t.get(key));
}
};
f(child);
f(node);
f(n);
f(hash);
f(event.U);
agent.set(has(attrs).F, read(t));
var names = event.aa;
agent.map(function(option, x) {
names += jQuery(option) + "=";
names += jQuery("" + x) + "&";
});
names += "z=" + $timeout();
resolve(names);
t.set(event.U, "", true);
}
};
/** @type {RegExp} */
var isSimple = /^gtm\d+$/;
/**
* @param {Node} event
* @param {Object} result
* @return {undefined}
*/
var error = function(event, result) {
var type = event.b;
if (!type.get("dcLoaded")) {
reset(type, 29);
result = result || {};
var e;
if (result[item]) {
e = parse(result[item]);
}
e = new add(type, "https://stats.g.doubleclick.net/r/collect?t=dc&aip=1&_r=3&", e);
save(e, type);
type.set("dcLoaded", true);
}
};
/**
* @param {Object} value
* @return {undefined}
*/
var _init = function(value) {
var node;
/** @type {boolean} */
node = value.get("dcLoaded") ? false : "cookie" != value.get(r) ? false : true;
if (node) {
reset(value, 51);
node = new add(value);
hide(node, value);
click(node, value);
if (value.get(node.U)) {
value.set(elem, 1, true);
value.set(third, split() + "/r/collect", true);
}
}
};
/**
* @return {?}
*/
var removeNode = function() {
var order = global.gaGlobal = global.gaGlobal || {};
return order.hid = order.hid || $timeout();
};
var ad;
/**
* @param {boolean} v
* @param {?} value
* @param {?} callback
* @return {undefined}
*/
var set = function(v, value, callback) {
if (!ad) {
var name;
/** @type {string} */
name = doc.location.hash;
/** @type {string} */
var c = global.name;
/** @type {RegExp} */
var re = /^#?gaso=([^&]*)/;
if (c = (name = (name = name && name.match(re) || c && c.match(re)) ? name[1] : $("GASO")[0] || "") && name.match(/^(?:!([-0-9a-z.]{1,40})!)?([-.\w]{10,1200})$/i)) {
remove("GASO", "" + name, callback, value, v, 0);
if (!window._udo) {
window._udo = value;
}
if (!window._utcp) {
window._utcp = callback;
}
v = c[1];
loadScript("https://www.google.com/analytics/web/inpage/pub/inpage.js?" + (v ? "prefix=" + v + "&" : "") + $timeout(), "_gasojs");
}
/** @type {boolean} */
ad = true;
}
};
/** @type {RegExp} */
var arrayRegex = /^(UA|YT|MO|GP)-(\d+)-(\d+)$/;
/**
* @param {?} map
* @return {undefined}
*/
var constructor = function(map) {
/**
* @param {?} key
* @param {Object} value
* @return {undefined}
*/
function func(key, value) {
obj.b.data.set(key, value);
}
/**
* @param {?} key
* @param {Function} callback
* @return {undefined}
*/
function add(key, callback) {
func(key, callback);
obj.filters.add(key);
}
var obj = this;
this.b = new Controller;
this.filters = new Dictionary;
func(code, map[code]);
func(n, extend(map[n]));
func(item, map[item]);
func(name, map[name] || update());
func(url, map[url]);
func(path, map[path]);
func(number, map[number]);
func(cur, map[cur]);
func(second, map[second]);
func(k, map[k]);
func(id, map[id]);
func(i, map[i]);
func(command, map[command]);
func(r, map[r]);
func(pos, map[pos]);
func(child, 1);
func(node, "j39");
add(j, finish);
add(arg, which);
add(prefix, restoreScript);
add(keyname, handleResponse);
add(later, cb);
add(input, complete);
add(base, install);
add(loc, loop);
add(gui, end);
add(progress, build);
add(win, _init);
add(storageKey, load);
add(expr, setup);
add(uid, validate(this));
get(this.b, map[hash]);
handler(this.b);
this.b.set(serverAttrs, removeNode());
set(this.b.get(n), this.b.get(name), this.b.get(url));
};
/**
* @param {Object} e
* @param {string} field
* @return {undefined}
*/
var get = function(e, field) {
if ("cookie" == done(e, r)) {
/** @type {boolean} */
hc = false;
var s;
b: {
var data = $(done(e, item));
if (data && !(1 > data.length)) {
/** @type {Array} */
s = [];
/** @type {number} */
var a = 0;
for (;a < data.length;a++) {
var args;
args = data[a].split(".");
var val = args.shift();
if (("GA1" == val || "1" == val) && 1 < args.length) {
val = args.shift().split("-");
if (1 == val.length) {
/** @type {string} */
val[1] = "1";
}
val[0] *= 1;
val[1] *= 1;
args = {
H : val,
s : args.join(".")
};
} else {
args = void 0;
}
if (args) {
s.push(args);
}
}
if (1 == s.length) {
replace(13);
s = s[0].s;
break b;
}
if (0 == s.length) {
replace(12);
} else {
replace(14);
data = assert(done(e, name));
s = log(s, data, 0);
if (1 == s.length) {
s = s[0].s;
break b;
}
data = stringify(done(e, url));
s = log(s, data, 1);
s = s[0] && s[0].s;
break b;
}
}
s = void 0;
}
if (!s) {
s = done(e, name);
data = done(e, number) || update();
s = insert("__utma", data, s);
if (void 0 != s) {
replace(10);
s = s.O[1] + "." + s.O[2];
} else {
s = void 0;
}
}
if (s) {
e.data.set(hash, s);
/** @type {boolean} */
hc = true;
}
}
s = e.get(k);
if (a = (s = doc.location[s ? "href" : "search"].match("(?:&|#|\\?)" + jQuery("_ga").replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1") + "=([^&#]*)")) && 2 == s.length ? s[1] : "") {
if (e.get(second)) {
s = a.indexOf(".");
if (-1 == s) {
replace(22);
} else {
data = a.substring(s + 1);
if ("1" != a.substring(0, s)) {
replace(22);
} else {
s = data.indexOf(".");
if (-1 == s) {
replace(22);
} else {
a = data.substring(0, s);
s = data.substring(s + 1);
if (a != formatDate(s, 0) && (a != formatDate(s, -1) && a != formatDate(s, -2))) {
replace(23);
} else {
replace(11);
e.data.set(hash, s);
}
}
}
}
} else {
replace(21);
}
}
if (field) {
replace(9);
e.data.set(hash, jQuery(field));
}
if (!e.get(hash)) {
if (s = (s = global.gaGlobal && global.gaGlobal.vid) && -1 != s.search(/^(?:utma\.)?\d+\.\d+$/) ? s : void 0) {
replace(17);
e.data.set(hash, s);
} else {
replace(8);
e.data.set(hash, [$timeout() ^ parseCookies() & 2147483647, Math.round((new Date).getTime() / 1E3)].join("."));
}
}
start(e);
};
/**
* @param {HTMLElement} self
* @return {undefined}
*/
var handler = function(self) {
/** @type {(Navigator|null)} */
var value = global.navigator;
/** @type {(Screen|null)} */
var e = global.screen;
/** @type {Location} */
var loc = doc.location;
self.set(parentNode, create(self.get(command)));
if (loc) {
/** @type {string} */
var parent = loc.pathname || "";
if ("/" != parent.charAt(0)) {
replace(31);
/** @type {string} */
parent = "/" + parent;
}
self.set(key, loc.protocol + "//" + loc.hostname + parent + loc.search);
}
if (e) {
self.set(key2, e.width + "x" + e.height);
}
if (e) {
self.set(methods, e.colorDepth + "-bit");
}
/** @type {Element} */
e = doc.documentElement;
/** @type {(null|number)} */
var CSS1Compat = (parent = doc.body) && (parent.clientWidth && parent.clientHeight);
/** @type {Array} */
var acc = [];
if (e && (e.clientWidth && (e.clientHeight && ("CSS1Compat" === doc.compatMode || !CSS1Compat)))) {
/** @type {Array} */
acc = [e.clientWidth, e.clientHeight];
} else {
if (CSS1Compat) {
/** @type {Array} */
acc = [parent.clientWidth, parent.clientHeight];
}
}
/** @type {string} */
e = 0 >= acc[0] || 0 >= acc[1] ? "" : acc.join("x");
self.set(expireKey, e);
self.set(cacheKey, getFlashVersion());
self.set(KEY, doc.characterSet || doc.charset);
self.set(actualKey, value && ("function" === typeof value.javaEnabled && value.javaEnabled()) || false);
self.set(properties, (value && (value.language || value.browserLanguage) || "").toLowerCase());
if (loc && (self.get(k) && (value = doc.location.hash))) {
/** @type {Array.<string>} */
value = value.split(/[?&#]+/);
/** @type {Array} */
loc = [];
/** @type {number} */
e = 0;
for (;e < value.length;++e) {
if (fix(value[e], "utm_id") || (fix(value[e], "utm_campaign") || (fix(value[e], "utm_source") || (fix(value[e], "utm_medium") || (fix(value[e], "utm_term") || (fix(value[e], "utm_content") || (fix(value[e], "gclid") || (fix(value[e], "dclid") || fix(value[e], "gclsrc"))))))))) {
loc.push(value[e]);
}
}
if (0 < loc.length) {
/** @type {string} */
value = "#" + loc.join("&");
self.set(key, self.get(key) + value);
}
}
};
/**
* @param {?} key
* @return {?}
*/
constructor.prototype.get = function(key) {
return this.b.get(key);
};
/**
* @param {?} key
* @param {Object} value
* @return {undefined}
*/
constructor.prototype.set = function(key, value) {
this.b.set(key, value);
};
var out = {
pageview : [result],
event : [event, hosts, res, ret],
social : [new_value, social, perc_ind],
timing : [range, timing, timingValue, timingLabel]
};
/**
* @param {string} event
* @return {undefined}
*/
constructor.prototype.send = function(event) {
if (!(1 > arguments.length)) {
var n;
var args;
if ("string" === typeof arguments[0]) {
n = arguments[0];
/** @type {Array.<?>} */
args = [].slice.call(arguments, 1);
} else {
n = arguments[0] && arguments[0][p];
/** @type {Arguments} */
args = arguments;
}
if (n) {
args = apply(out[n] || [], args);
args[p] = n;
this.b.set(args, void 0, true);
this.filters.D(this.b);
this.b.data.m = {};
process(this.b);
}
}
};
/**
* @param {Function} callback
* @return {?}
*/
var flush = function(callback) {
if ("prerender" == doc.visibilityState) {
return false;
}
callback();
return true;
};
/** @type {RegExp} */
var rquickExpr = /^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/;
/**
* @param {Array} a
* @return {undefined}
*/
var format = function(a) {
if (isFunction(a[0])) {
this.u = a[0];
} else {
/** @type {(Array.<string>|null)} */
var str = rquickExpr.exec(a[0]);
if (null != str) {
if (4 == str.length) {
/** @type {string} */
this.c = str[1] || "t0";
/** @type {string} */
this.K = str[2] || "";
/** @type {string} */
this.C = str[3];
/** @type {Array.<?>} */
this.a = [].slice.call(a, 1);
if (!this.K) {
/** @type {boolean} */
this.A = "create" == this.C;
/** @type {boolean} */
this.i = "require" == this.C;
/** @type {boolean} */
this.g = "provide" == this.C;
/** @type {boolean} */
this.ba = "remove" == this.C;
}
if (this.i) {
if (3 <= this.a.length) {
this.X = this.a[1];
this.W = this.a[2];
} else {
if (this.a[1]) {
if (toString(this.a[1])) {
this.X = this.a[1];
} else {
this.W = this.a[1];
}
}
}
}
}
}
str = a[1];
a = a[2];
if (!this.C) {
throw "abort";
}
if (this.i && (!toString(str) || "" == str)) {
throw "abort";
}
if (this.g && (!toString(str) || ("" == str || !isFunction(a)))) {
throw "abort";
}
if (endsWith(this.c) || endsWith(this.K)) {
throw "abort";
}
if (this.g && "t0" != this.c) {
throw "abort";
}
}
};
var data_user;
var storage;
var localStorage;
data_user = new Map;
localStorage = new Map;
storage = {
ec : 45,
ecommerce : 46,
linkid : 47
};
/**
* @param {string} url
* @return {?}
*/
var init = function(url) {
/**
* @param {string} url
* @return {?}
*/
function init(url) {
var b = (url.hostname || "").split(":")[0].toLowerCase();
var val = (url.protocol || "").toLowerCase();
/** @type {(number|string)} */
val = 1 * url.port || ("http:" == val ? 80 : "https:" == val ? 443 : "");
url = url.pathname || "";
if (!fix(url, "/")) {
/** @type {string} */
url = "/" + url;
}
return[b, "" + val, url];
}
/** @type {Element} */
var link = doc.createElement("a");
/** @type {string} */
link.href = doc.location.href;
var host = (link.protocol || "").toLowerCase();
var m = init(link);
var home = link.search || "";
var fullUrl = host + "//" + m[0] + (m[1] ? ":" + m[1] : "");
if (fix(url, "//")) {
url = host + url;
} else {
if (fix(url, "/")) {
url = fullUrl + url;
} else {
if (!url || fix(url, "?")) {
url = fullUrl + m[2] + (url || home);
} else {
if (0 > url.split("/")[0].indexOf(":")) {
/** @type {string} */
url = fullUrl + m[2].substring(0, m[2].lastIndexOf("/")) + "/" + url;
}
}
}
}
/** @type {string} */
link.href = url;
host = init(link);
return{
protocol : (link.protocol || "").toLowerCase(),
host : host[0],
port : host[1],
path : host[2],
G : link.search || "",
url : url || ""
};
};
var e = {
/**
* @return {undefined}
*/
ga : function() {
/** @type {Array} */
e.f = [];
}
};
e.ga();
/**
* @param {?} data
* @return {undefined}
*/
e.D = function(data) {
var p = e.J.apply(e, arguments);
/** @type {Array} */
p = e.f.concat(p);
/** @type {Array} */
e.f = [];
for (;0 < p.length && (!e.v(p[0]) && !(p.shift(), 0 < e.f.length));) {
}
/** @type {Array} */
e.f = e.f.concat(p);
};
/**
* @param {?} a
* @return {?}
*/
e.J = function(a) {
/** @type {Array} */
var readyList = [];
/** @type {number} */
var i = 0;
for (;i < arguments.length;i++) {
try {
var obj = new format(arguments[i]);
if (obj.g) {
data_user.set(obj.a[0], obj.a[1]);
} else {
if (obj.i) {
var node = obj;
var storageKey = node.a[0];
if (!isFunction(data_user.get(storageKey)) && !localStorage.get(storageKey)) {
if (storage.hasOwnProperty(storageKey)) {
replace(storage[storageKey]);
}
var x = node.X;
if (!x && storage.hasOwnProperty(storageKey)) {
replace(39);
/** @type {string} */
x = storageKey + ".js";
} else {
replace(43);
}
if (x) {
if (!(x && 0 <= x.indexOf("/"))) {
/** @type {string} */
x = (elements || slice() ? "https:" : "http:") + "//www.google-analytics.com/plugins/ua/" + x;
}
var o = init(x);
node = void 0;
var method = o.protocol;
/** @type {string} */
var all = doc.location.protocol;
/** @type {boolean} */
node = "https:" == method || method == all ? true : "http:" != method ? false : "http:" == all;
var targetNode;
if (targetNode = node) {
node = o;
var instanceServer = init(doc.location.href);
if (node.G || (0 <= node.url.indexOf("?") || 0 <= node.path.indexOf("://"))) {
/** @type {boolean} */
targetNode = false;
} else {
if (node.host == instanceServer.host && node.port == instanceServer.port) {
/** @type {boolean} */
targetNode = true;
} else {
/** @type {number} */
var defaultPort = "http:" == node.protocol ? 80 : 443;
/** @type {boolean} */
targetNode = "www.google-analytics.com" == node.host && ((node.port || defaultPort) == defaultPort && fix(node.path, "/plugins/")) ? true : false;
}
}
}
if (targetNode) {
loadScript(o.url);
localStorage.set(storageKey, true);
}
}
}
}
readyList.push(obj);
}
} catch (de) {
}
}
return readyList;
};
/**
* @param {Object} item
* @return {?}
*/
e.v = function(item) {
try {
if (item.u) {
item.u.call(global, that.j("t0"));
} else {
var self = item.c == namespace ? that : that.j(item.c);
if (item.A) {
if ("t0" == item.c) {
that.create.apply(that, item.a);
}
} else {
if (item.ba) {
that.remove(item.c);
} else {
if (self) {
if (item.i) {
var c;
var storageKey = item.a[0];
var value = item.W;
if (!(self == that)) {
self.get(code);
}
var suiteView = data_user.get(storageKey);
if (isFunction(suiteView)) {
self.plugins_ = self.plugins_ || new Map;
if (!self.plugins_.get(storageKey)) {
self.plugins_.set(storageKey, new suiteView(self, value || {}));
}
/** @type {boolean} */
c = true;
} else {
/** @type {boolean} */
c = false;
}
if (!c) {
return true;
}
} else {
if (item.K) {
var type = item.C;
var a = item.a;
var _t = self.plugins_.get(item.K);
_t[type].apply(_t, a);
} else {
self[item.C].apply(self, item.a);
}
}
}
}
}
}
} catch (w) {
}
};
/**
* @param {?} dataAndEvents
* @return {undefined}
*/
var that = function(dataAndEvents) {
replace(1);
e.D.apply(e, [arguments]);
};
that.h = {};
/** @type {Array} */
that.P = [];
/** @type {number} */
that.L = 0;
/** @type {number} */
that.answer = 42;
/** @type {Array} */
var params = [n, name, code];
/**
* @param {?} var_args
* @return {?}
*/
that.create = function(var_args) {
var data = apply(params, [].slice.call(arguments));
if (!data[code]) {
/** @type {string} */
data[code] = "t0";
}
var q = "" + data[code];
if (that.h[q]) {
return that.h[q];
}
data = new constructor(data);
that.h[q] = data;
that.P.push(data);
return data;
};
/**
* @param {?} path
* @return {undefined}
*/
that.remove = function(path) {
/** @type {number} */
var i = 0;
for (;i < that.P.length;i++) {
if (that.P[i].get(code) == path) {
that.P.splice(i, 1);
/** @type {null} */
that.h[path] = null;
break;
}
}
};
/**
* @param {string} t
* @return {?}
*/
that.j = function(t) {
return that.h[t];
};
/**
* @return {?}
*/
that.getAll = function() {
return that.P.slice(0);
};
/**
* @return {undefined}
*/
that.N = function() {
if ("ga" != namespace) {
replace(49);
}
var data = global[namespace];
if (!data || 42 != data.answer) {
that.L = data && data.l;
/** @type {boolean} */
that.loaded = true;
/** @type {function (?): undefined} */
var result = global[namespace] = that;
expect("create", result, result.create);
expect("remove", result, result.remove);
expect("getByName", result, result.j, 5);
expect("getAll", result, result.getAll, 6);
result = constructor.prototype;
expect("get", result, result.get, 7);
expect("set", result, result.set, 4);
expect("send", result, result.send);
result = Controller.prototype;
expect("get", result, result.get);
expect("set", result, result.set);
if (!slice() && !elements) {
a: {
/** @type {NodeList} */
result = doc.getElementsByTagName("script");
/** @type {number} */
var n = 0;
for (;n < result.length && 100 > n;n++) {
var src = result[n].src;
if (src && 0 == src.indexOf("https://www.google-analytics.com/analytics")) {
replace(33);
/** @type {boolean} */
result = true;
break a;
}
}
/** @type {boolean} */
result = false;
}
if (result) {
/** @type {boolean} */
elements = true;
}
}
if (!slice()) {
if (!elements) {
if (!!run(new standard)) {
replace(36);
/** @type {boolean} */
elements = true;
}
}
}
/** @type {function (Object): undefined} */
(global.gaplugins = global.gaplugins || {}).Linker = udataCur;
result = udataCur.prototype;
data_user.set("linker", udataCur);
expect("decorate", result, result.ca, 20);
expect("autoLink", result, result.S, 25);
data_user.set("displayfeatures", error);
data_user.set("adfeatures", error);
data = data && data.q;
if (getType(data)) {
e.D.apply(that, data);
} else {
replace(50);
}
}
};
/**
* @return {undefined}
*/
that.da = function() {
var codeSegments = that.getAll();
/** @type {number} */
var i = 0;
for (;i < codeSegments.length;i++) {
codeSegments[i].get(code);
}
};
(function() {
/** @type {function (): undefined} */
var restoreScript = that.N;
if (!flush(restoreScript)) {
replace(16);
/** @type {boolean} */
var ie_lt8 = false;
/**
* @return {undefined}
*/
var fn = function() {
if (!ie_lt8 && flush(restoreScript)) {
/** @type {boolean} */
ie_lt8 = true;
/** @type {function (): undefined} */
var f = fn;
/** @type {HTMLDocument} */
var obj = doc;
if (obj.removeEventListener) {
obj.removeEventListener("visibilitychange", f, false);
} else {
if (obj.detachEvent) {
obj.detachEvent("onvisibilitychange", f);
}
}
}
};
on(doc, "visibilitychange", fn);
}
})();
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment