/*! * uact.js - v0.2.1 * build: Thu May 17 2018 18:03:26 GMT-0500 (CDT) * UTM auto click tracker */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("uact",[],t):"object"==typeof exports?exports.uact=t():e.uact=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=0&&t.item(n)!==r;);}while(n<0&&(r=r.parentElement));return r});var p=function(){function e(){i(this,e),this.wu=s,this.log=s.debug("uact"),this._name="Uact",this._brxua="79697394-26",this.init()}return o(e,[{key:"init",value:function(){var e=this;h.debug&&s.debug.enable(h.debug),e.setupHandlers(),!h.disableDeepTracking&&s.win.jQuery&&d.indexOf("utm_")>-1&&(e.log("begin updating anchors"),s.win.jQuery(s.doc).ready(function(){s.each(s.win.jQuery("a"),function(t,n){var r=s.isNull(s.getAttr(t,"href"),""),i=r.split("#");if(i[0].length<=0||/\w+:\w+/gi.test(r)||r.toLowerCase().indexOf("javascript:")>-1||r.toLowerCase().indexOf("utm_")>-1)return void e.log("update skip ["+r+"]");i[0]=i[0]+(i[0].indexOf("?")<0?"?":"&")+d,i[1]&&(i[0]=i[0]+"#"+i[1]),e.log("update from ["+r+"] to ["+i[0]+"]"),s.setAttr(t,"href",i[0])})}))}},{key:"setupHandlers",value:function(){function e(e){var n=s.queryParseString(d),r={};if(s.each(n,function(e,t){r[t.toLowerCase()]=e}),r.utm_name&&(r.utm_campaign=r.utm_name),s.isNull(r.utm_campaign,"").length<2)return void t.log("exiting: invalid utm_campaign");var i=e||t.win.event,o=i.target||i.srcElement,a=o.closest("button"),u={query:r,category:r.utm_campaign,value:1},c=(o.tagName+"").toLowerCase();if("input"===c){var l=o.type.toLowerCase();if("submit"!==l&&"button"!==l)return void t.log("exiting from "+e.type+" - ignoring input type "+l);u.action=o.name||o.id||e.type||"button action",u.label=o.value}else if("select"===c&&o.options&&o.selectedIndex){var f=o.options[o.selectedIndex];f&&(u.action=o.name||o.id||e.type||"select action",u.label=f.value+"_"+f.text)}else if(a)u.action=a.name||a.id||e.type||"button action",u.label=a.textContent||a.innerText;else{if("change"===e.type)return void t.log("exiting from non-select change event");if("submit"===e.type)u.action="submit action",u.label=o.action;else{var h=o.closest("a");if(!h)return void t.log("exiting from "+e.type+" event with no valid parent element");u.action=s.getAttr(h,"href"),u.label=h.textContent||h.innerText}}if(!u.action)return void t.log("exiting from "+e.type+" - no action to log");if(t.log("triggering..."),t.log(u),t._brxua){var p=new Image(1,1),v={ea:u.action,el:u.label,ev:u.value,ec:u.category+"_"+s.win.location.hostname,cb:(new Date).getTime()};v.ea||(v=s.del(v,"ea")),v.el||(v=s.del(v,"el")),p.src="https://pi.brickinc.net/ua/"+t._brxua+"?"+s.queryStringify(v)+"&"+d}if(void 0!==s.win.dataLayer){var g=s.win.dataLayer;(s.win.gtag||function(){g.push(arguments)})("event",u.action,{event_category:u.category,event_label:u.label,value:u.value})}if(void 0!==s.win.ga){s.win.ga.getAll().forEach(function(e){s.win.ga(e.get("name")+".send","event",u.category,u.action,u.label,u.value)})}}var t=this;s.addEvent(s.doc,"click",e),s.addEvent(s.doc,"tap",e),s.addEvent(s.doc,"change",e),s.addEvent(s.doc,"submit",e)}},{key:"name",get:function(){return this._name}}]),e}();void 0===s.win.uact&&(s.win.uact=new p),t.default=s.win.uact,e.exports=t.default},function(e,t,n){/*! * wu.js - v0.3.0 * build: Fri May 19 2017 16:55:00 GMT-0500 (CDT) * web utils */ !function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=9)}([function(e,t,n){(function(r){function i(){return!("undefined"==typeof window||!window||void 0===window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document&&"WebkitAppearance"in document.documentElement.style||"undefined"!=typeof window&&window&&window.console&&(console.firebug||console.exception&&console.table)||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){var n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),n){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var i=0,o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r)}}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function u(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function s(){var e;try{e=t.storage.debug}catch(e){}return!e&&void 0!==r&&"env"in r&&(e=r.env.DEBUG),e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=n(5),t.log=a,t.formatArgs=o,t.save=u,t.load=s,t.useColors=i,t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(s())}).call(t,n(8))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){return void 0===e||null===e||"null"===e?t:e}function a(){var e=M,t=e.indexOf("MSIE "),n=e.indexOf("Trident/"),r=e.indexOf("rv:");return t>0?parseInt(e.substring(t+5,e.indexOf(".",t)),10):n>0&&parseInt(e.substring(r+3,e.indexOf(".",r)),10)}function u(e,t){return _.call(e,t)}function s(e){if(S)return S(e);if(e!==Object(e))throw new TypeError("Invalid object");var t=[],n=void 0;for(n in e)u(e,n)&&t.push(n);return t}function c(e,t,n){if(null!==o(e,null))if(C&&e.forEach===C)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,i=e.length;rc*v:c*v}},{key:"geoOrderByOrigin",value:function(e,t,n){var r=this,i={origin:t,results:[]};return c(e,function(e){var n=r.geoDistance(t.Latitude,t.Longitude,e.Latitude,e.Longitude,{unit:"mile"}),o={point:e,distance:parseFloat(r.isNull(n,0)).toFixed(2)};i.results.push(o)}),this.sortOn(i.results,"distance"),n(i),this}},{key:"geoOrderByIP",value:function(e,t,n){var r=this;return this.geoByIP(t,function(t){t.latitude&&(t.Latitude=t.latitude,t.Longitude=t.longitude,r.geoOrderByOrigin(e,t,n))}),this}},{key:"geoByIP",value:function(e,t){this.jsonp(e||"//freegeoip.net/json/",t)}},{key:"getAjaxObject",value:function(){return"XMLHttpRequest"in window?new XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP")}},{key:"getAttr",value:function(e,t,n){if(arguments.length>2)return this.setAttr(e,t,n);var r=e[0]||e;return r.getAttribute?r.getAttribute(t):r[t]}},{key:"getAttrs",value:function(e,t){var n={},r=this;return c(["","data-"],function(i,o){c(t||[],function(t,o){var a=r.getAttr(e,i+o);a&&(n[o]=a)})}),n}},{key:"setAttr",value:function(e,t,n){var r=e[0]||e;return r.setAttribute?r.setAttribute(t,n):r[t]=n,n}},{key:"setAttrs",value:function(e,t){var n=e[0]||e,r=this;return c(t||[],function(e,t){r.setAttr(n,t,e)}),n}},{key:"contains",value:function(e,t){return null!==this.isNull(e,null)&&(j&&e.indexOf===j?-1!==e.indexOf(t):this.any(e,function(e){return e===t}))}},{key:"createiFrame",value:function(e,t){var n=this.doc.createElement("iframe");return e&&(n.id=e),t&&(n.className=t),n.frameBorder="0",n.marginWidth="0",n.marginHeight="0",n.setAttribute("border","0"),n.setAttribute("allowtransparency","true"),n.width="100%",n.height="100%",n}},{key:"del",value:function(e,t){e[t]=void 0;try{delete e[t]}catch(r){var n={};return c(e,function(e,r){r!==t&&(n[r]=e)}),n}return e}},{key:"defaults",value:function(e){return c(A.call(arguments,1),function(t){void 0!==t&&c(t,function(t,n){null===o(e[n],null)&&(e[n]=t)})}),e}},{key:"extend",value:function(e){return c(A.call(arguments,1),function(t){void 0!==t&&c(t,function(t,n){null!==o(t,null)&&(e[n]=t)})}),e}},{key:"groupBy",value:function(e,t,n){if(null===this.isNull(e,null))return[];var r=[],i={};c(e,function(e){var n=e[t],r=i[n];null===o(r,null)&&(r={key:n,items:[]},i[n]=r),r.items.push(e)});var a=0;return c(i,function(e){e.$idx=a++,r.push(e),n&&n(e)}),this.sortOn(r,"key")}},{key:"hasCls",value:function(e,t){var n=void 0,r=void 0,i=void 0,o=void 0,a=void 0;for(o=t.split(" "),r=n=0,i=o.length;n=0)return!0;return!1}},{key:"injectStyle",value:function(e,t){var n=void 0,r=void 0,i=this;return n=i.doc.getElementById(e),n||(n=i.doc.createElement("style"),n.id=e,n.type="text/css",n.styleSheet?n.styleSheet.cssText=t:n.appendChild(i.doc.createTextNode(t)),r=i.doc.getElementsByTagName("link")[0],r=r||(i.doc.head||i.doc.getElementsByTagName("head")[0]).lastChild,r.parentNode.insertBefore(n,r)),i}},{key:"jsonp",value:function(e,t){var n="wucb"+(new Date).getTime();this.win[n]=function(e){var n=e;"string"==typeof e&&(n="null"===e?null:JSON.parse(e)),t(n)},e=e,e+=(e.indexOf("?")>0?"&":"?")+"callback="+n,this.loadScript(e)}},{key:"loadScript",value:function(e,t){function n(){void 0!==this.readyState&&"complete"!==this.readyState||"function"==typeof t&&t()}var r=void 0;e.indexOf("//")<0&&(e="http:"+e),"file"===(x.location||{}).protocol&&(e=e.replace("https://","http://")),r=this.doc.createElement("script"),r.type="text/javascript",r.src=e,t&&(r.onload=n,r.onreadystatechange=n),this.doc.body.appendChild(r)}},{key:"loadScripts",value:function(e,t){function n(){if(r.length<=0)"function"==typeof t&&t();else{var e=r[0];r.splice(0,1),i.loadScript(e,n)}}var r=void 0,i=this;this.isNull(e.length,0)<=0?"function"==typeof t&&t():("string"==typeof e&&(e=[e]),r=[].concat(e),n())}},{key:"loadiFrame",value:function(e,t,n,r){var i=this.createiFrame(n,r);if(e[0].appendChild(i),i.contentWindow)i.contentWindow.contents=t,i.src='javascript:window["contents"]';else{var o=i.contentDocument||i.document;o.open(),o.write(t),o.close()}return i}},{key:"map",value:function(e,t,n){var r=[];return null===this.isNull(e,null)?r:T&&e.map===T?e.map(t,n):(c(e,function(e,i,o){r.push(t.call(n,e,i,o))}),r)}},{key:"mapObject",value:function(e,t){var n={};return e&&(this.isNull(e.length,-1)<0?n[e[t]]=e:this.map(e,function(e,r){var i=e[t],o=n[i];o?("[object Array]"!==Object.prototype.toString.call(o)&&(o=[o]),o.push(e)):o=e,n[i]=o})),n}},{key:"queryParseString",value:function(e){e=(e||"").replace("?","").replace("#","");for(var t=/(\w+)\[(\d+)\]/,n=this.decode,r={},i=e.split("&"),o=0;o-1?e.data&&(e.url+=(e.url.indexOf("?")>0?"?":"&")+r.queryStringify(e.data),e=this.del(e,"data")):"string"!=typeof e.data&&((e.headers["Content-Type"]+"").indexOf("json")>0?e.data=JSON.stringify(e):e.data=r.queryStringify(e)),r.xhr(e,t,n)}},{key:"slugify",value:function(e){return""===(e=e||"")?e:e=e.toLowerCase().replace(/[^0-9a-z\-\_]+/gi,"-").replace(/[\-]+/gi,"-")}},{key:"some",value:function(e,t,n){var r=!1;return t=t||function(e){return e},null===this.isNull(e,null)?r:L&&e.some===L?e.some(t,n):(c(e,function(e,i,o){return r||(r=t.call(n,e,i,o))?k:null}),r)}},{key:"sortOn",value:function(e,t){return null===this.isNull(e,null)?null:e.length<=0?[]:("string"==typeof e[0][t]?e.sort(function(e,n){return(e[t]&&e[t].toLowerCase())<(n[t]&&n[t].toLowerCase())?-1:(e[t]&&e[t].toLowerCase())>(n[t]&&n[t].toLowerCase())?1:0}):e.sort(function(e,n){return e[t]n[t]?1:0}),e)}},{key:"trim",value:function(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}},{key:"uuid",value:function(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,this.uuid)}},{key:"xhr",value:function(e,t,n){var r=e;"string"==typeof r&&(e=e||{},e.url=r);var i=this.getAjaxObject();return e.withCredentials&&(i.withCredentials=!0,"undefined"!=typeof XDomainRequest&&(i=new XDomainRequest)),e&&0!==e.length||n({xhr:i,error:new Error("xhr expects an url or an options object, none given.")}),e.method=e.method||"GET",i.open(e.method,e.url,i.withCredentials),c(e.headers||{},function(e,t){i.setRequestHeader(t,e)}),this.addEvent(i,"readystatechange",function(){4===i.readyState&&i.status>=200&&i.status<400?t({xhr:i,text:i.responseText,url:i.responseURL}):4===i.readyState&&n({xhr:i})}),this.addEvent(i,"error",function(e){n({xhr:i,error:e})}),e.nosend||i.send(e.data||void 0),i}},{key:"name",get:function(){return this._name}}]),e}();t.default=N,e.exports=t.default},function(e,t,n){function r(e,t,n){n=n||{};var r=u(e)+"="+u(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.secure&&(r+="; secure"),document.cookie=r}function i(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return a(e)}function o(e){return i()[e]}function a(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i=0?i=setTimeout(r,t-c):(i=null,n||(s=e.apply(a,o),a=o=null))}var i,o,a,u,s;null==t&&(t=100);var c=function(){a=this,o=arguments,u=Date.now();var c=n&&!i;return i||(i=setTimeout(r,t)),c&&(s=e.apply(a,o),a=o=null),s};return c.clear=function(){i&&(clearTimeout(i),i=null)},c}},function(e,t,n){function r(e){var n,r=0;for(n in e)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]}function i(e){function n(){if(n.enabled){var e=n,r=+new Date,i=r-(c||r);e.diff=i,e.prev=c,e.curr=r,c=r;for(var o=new Array(arguments.length),a=0;a
a',i=!r.getElementsByTagName("link").length,r=void 0);var o={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:i?[1,"X
","
"]:[0,"",""]};o.td=o.th=[3,"","
"],o.option=o.optgroup=[1,'"],o.thead=o.tbody=o.colgroup=o.caption=o.tfoot=[1,"","
"],o.polyline=o.ellipse=o.polygon=o.circle=o.text=o.line=o.path=o.rect=o.g=[1,'',""]},function(e,t){function n(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*s;case"minutes":case"minute":case"mins":case"min":case"m":return n*u;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(e){return e>=c?Math.round(e/c)+"d":e>=s?Math.round(e/s)+"h":e>=u?Math.round(e/u)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function i(e){return o(e,c,"day")||o(e,s,"hour")||o(e,u,"minute")||o(e,a,"second")||e+" ms"}function o(e,t,n){if(!(e0)return n(e);if("number"===o&&!1===isNaN(e))return t.long?i(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function o(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){v&&h&&(v=!1,h.length?p=h.concat(p):g=-1,p.length&&u())}function u(){if(!v){var e=i(a);v=!0;for(var t=p.length;t;){for(h=p,p=[];++g1)for(var n=1;n