!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=46)}([function(e,t){e.exports=function(e,t,n){var r;if(!e)return 0;if(n=n||e,e instanceof Array){for(r=0;r-1};l.prototype.append=function(e,t){e=a(e),t=u(t);var n=this.map[e];this.map[e]=n?n+","+t:t},l.prototype.delete=function(e){delete this.map[a(e)]},l.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},l.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},l.prototype.set=function(e,t){this.map[a(e)]=u(t)},l.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},l.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),c(e)},l.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},l.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),c(e)},t.iterable&&(l.prototype[Symbol.iterator]=l.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},v.call(m.prototype),v.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var s=[301,302,303,307,308];g.redirect=function(e,t){if(-1===s.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=l,e.Request=m,e.Response=g,e.fetch=function(e,n){return new Promise(function(r,o){var i=new m(e,n),s=new XMLHttpRequest;s.onload=function(){var e,t,n={status:s.status,statusText:s.statusText,headers:(e=s.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var o="response"in s?s.response:s.responseText;r(new g(o,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.open(i.method,i.url,!0),"include"===i.credentials?s.withCredentials=!0:"omit"===i.credentials&&(s.withCredentials=!1),"responseType"in s&&t.blob&&(s.responseType="blob"),i.headers.forEach(function(e,t){s.setRequestHeader(t,e)}),s.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function a(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function l(e){this.map={},e instanceof l?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function p(e){var t=new FileReader,n=d(t);return t.readAsArrayBuffer(e),n}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var e,t,n,r=f(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=d(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r-1?r:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function y(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e){e.exports={name:"keen-tracking",version:"5.0.1",description:"Track events - custom user actions, clicks, pageviews, purchases.",main:"dist/node/keen-tracking.js",browser:"dist/keen-tracking.js",repository:{type:"git",url:"https://github.com/keen/keen-tracking.js.git"},scripts:{start:"NODE_ENV=development webpack-dev-server",test:"NODE_ENV=test jest && npm run test:node","test:node":"NODE_ENV=test TEST_ENV=node jest","test:watch":"NODE_ENV=test jest --watch","test:node:watch":"NODE_ENV=test TEST_ENV=node jest --watch",build:"NODE_ENV=production webpack -p && NODE_ENV=production OPTIMIZE_MINIMIZE=1 webpack -p && npm run build:node","build:node":"TARGET=node NODE_ENV=production webpack -p",profile:"webpack --profile --json > stats.json",analyze:"webpack-bundle-analyzer stats.json /dist",preversion:"npm run build:node && npm run test",version:"npm run build && git add .",postversion:"git push && git push --tags && npm publish",demo:"node ./test/demo/index.node.js"},bugs:"https://github.com/keen/keen-tracking.js/issues",author:"Keen IO (https://keen.io/)",homepage:"https://keen.io",keywords:["Tracking","Tracker","Event Tracker","Event tracking","Track events","Page tracking","User tracking","Analytics event tracking","Analytics events","Analytics tracking","Custom events","Analytics","Stats","Statistics","Monitoring","Metrics","Pageviews","Segmentation","Funnel","Conversion","Log","Logger","Logging","Javascript events","Universal tracking","Click analytics"],contributors:["Dustin Larimer (https://github.com/dustinlarimer)","Eric Anderson (https://github.com/aroc)","Joe Wegner (http://www.wegnerdesign.com)","Alex Kleissner (https://github.com/hex337)","Adam Kasprowicz (https://github.com/adamkasprowicz)","Dariusz Łacheta (https://github.com/dariuszlacheta)"],license:"MIT",dependencies:{"component-emitter":"^1.2.0","js-cookie":"2.1.0","keen-core":"^0.1.3","promise-polyfill":"^8.0.0","whatwg-fetch":"^2.0.4"},devDependencies:{"babel-core":"^6.26.3","babel-jest":"^23.0.1","babel-loader":"^7.1.5","babel-plugin-transform-es2015-modules-commonjs":"^6.26.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-polyfill":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-es2015":"^6.24.1","babel-preset-stage-0":"^6.24.1",eslint:"^4.19.1","eslint-config-airbnb":"^16.1.0","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.11.0","eslint-plugin-jsx-a11y":"^6.0.3","html-loader":"^0.5.5","html-webpack-plugin":"^3.2.0",jest:"^22.4.3","jest-fetch-mock":"^1.6.5",merge:"^1.2.1",nock:"^9.2.6","regenerator-runtime":"^0.11.1","replace-in-file":"^3.4.0","url-parse":"^1.4.3",webpack:"^4.5.0","webpack-bundle-analyzer":"^3.3.2","webpack-cli":"^2.0.13","webpack-dev-server":"^3.1.14","xhr-mock":"^2.3.2"}}},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o1?t.unshift(e.nodeName.toLowerCase()+":eq("+r+")"):t.unshift(e.nodeName.toLowerCase()),e=e.parentNode}return t.slice(1).join(" > ")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWindowProfile=function(){var e,t,n;if("undefined"==typeof document)return{};e=document.body||{},t=document.documentElement||{},n={height:"innerHeight"in window?window.innerHeight:document.documentElement.offsetHeight,width:"innerWidth"in window?window.innerWidth:document.documentElement.offsetWidth,scrollHeight:Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)||null},window.screen&&(n.ratio={height:window.screen.availHeight?parseFloat((window.innerHeight/window.screen.availHeight).toFixed(2)):null,width:window.screen.availWidth?parseFloat((window.innerWidth/window.screen.availWidth).toFixed(2)):null});return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getScreenProfile=function(){var e,t;if("undefined"==typeof window||!window.screen)return{};e=["height","width","colorDepth","pixelDepth","availHeight","availWidth"],t={};for(var n=0;nwindow.innerHeight?"landscape":"portrait"},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=t.MD5=function(e){return function(e){for(var t,n="0123456789ABCDEF",r="",o=0;o>>4&15)+n.charAt(15&t);return r}(function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(function(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n=1732584193,r=-271733879,o=-1732584194,l=271733878,f=0;f>2),n=0;n>5]|=(255&e.charCodeAt(n/8))<>>32-t}(c(c(t,e),c(r,i)),o),n)}function i(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)}function s(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)}function a(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)}function u(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)}function c(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.deepExtend=function e(t){for(var n=1;n0&&(0,a.default)(t,function(t,n){var r="function"==typeof t?t():t;(0,i.deepExtend)(e,r)});return e};var o,i=n(14),s=n(0),a=(o=s)&&o.__esModule?o:{default:o};function u(e){this.emit("error","Event(s) not extended: "+e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.isLocalStorageAvailable=function(){try{return localStorage.setItem("test","test"),localStorage.removeItem("test"),!0}catch(e){return!1}}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setOptOut=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!r.isLocalStorageAvailable)return;if(e)return void localStorage.setItem("optout",e);localStorage.removeItem("optout")};var r=n(16)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return this instanceof a==!1?new a(e):(this.capacity=0,this.config=r({},i.default.queue,e),this.events={},this.interval=0,this.timer=null,this)}(0,o.default)(a.prototype),a.prototype.check=function(){return function(e){if(e.capacity>0&&e.interval>=e.config.interval)return!0;if(e.capacity>=e.config.capacity)return!0;return!1}(this)&&this.flush(),0!==this.config.interval&&0!==this.capacity||this.pause(),this},a.prototype.flush=function(){return this.emit("flush"),this.interval=0,this},a.prototype.pause=function(){return this.timer&&(clearInterval(this.timer),this.timer=null),this},a.prototype.start=function(){var e=this;return e.pause(),e.timer=setInterval(function(){e.interval++,e.check()},1e3),e}},function(e,t,n){"use strict";(function(e){var r=n(5),o=setTimeout;function i(){}function s(e){if(!(this instanceof s))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],f(e,this)}function a(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,s._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void c(t.promise,e)}u(t.promise,r)}else(1===e._state?u:c)(t.promise,e._value)})):e._deferreds.push(t)}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof s)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void f((r=n,o=t,function(){r.apply(o,arguments)}),e)}e._state=1,e._value=t,l(e)}catch(t){c(e,t)}var r,o}function c(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&s._immediateFn(function(){e._handled||s._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t-1)&&((t.disabled||!d.disabled)&&d.name&&i.test(d.nodeName)&&!o.test(d.type))){var p=d.name,h=d.value;if("checkbox"!==d.type&&"radio"!==d.type||d.checked||(h=void 0),t.empty){if("checkbox"!==d.type||d.checked||(h=""),"radio"===d.type&&(l[d.name]||d.checked?d.checked&&(l[d.name]=!0):l[d.name]=!1),void 0==h&&"radio"==d.type)continue}else if(!h)continue;if("select-multiple"!==d.type)n=s(n,p,h);else{h=[];for(var v=d.options,m=!1,y=0;y1){if("number"==typeof(i=e({path:"/"},r.defaults,i)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*i.expires),i.expires=a}try{s=JSON.stringify(o),/^[\{\[]/.test(s)&&(o=s)}catch(e){}return o=n.write?n.write(o,t):encodeURIComponent(String(o)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape),document.cookie=[t,"=",o,i.expires&&"; expires="+i.expires.toUTCString(),i.path&&"; path="+i.path,i.domain&&"; domain="+i.domain,i.secure?"; secure":""].join("")}t||(s={});for(var u=document.cookie?document.cookie.split("; "):[],c=/(%[0-9A-Z]{2})+/g,l=0;l=2?this.data[e]=t||null:"object"===(void 0===e?"undefined":r(e))&&1===arguments.length&&(0,i.default)(this.data,e),o.default.set(this.config.key,this.data,(0,i.default)(this.config.options,n||{})),this):this},a.prototype.expire=function(e){return e?o.default.set(this.config.key,this.data,(0,i.default)(this.config.options,{expires:e})):(o.default.remove(this.config.key),this.data={}),this},a.prototype.options=function(e){return arguments.length?(this.config.options="object"===(void 0===e?"undefined":r(e))?e:{},this):this.config.options},a.prototype.enabled=function(){return navigator.cookieEnabled}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueId=function(){if("undefined"!=typeof crypto&&crypto.getRandomValues)return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)});return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"==e?t:3&t|8;return n.toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.getScrollState=function(e){var t="object"===(void 0===e?"undefined":r(e))?e:{},n=(0,s.default)({pixel:0,pixel_max:0,ratio:null,ratio_max:null},t);void 0===("undefined"==typeof window?"undefined":r(window))&&void 0===("undefined"==typeof document?"undefined":r(document))||(n.pixel=(void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop)+(window.innerHeight||document.documentElement.clientHeight),n.pixel>n.pixel_max&&(n.pixel_max=n.pixel),n.ratio=parseFloat(Number(n.pixel/a()).toFixed(2)),n.ratio_max=parseFloat(Number(n.pixel_max/a()).toFixed(2)));return n};var o,i=n(1),s=(o=i)&&o.__esModule?o:{default:o};function a(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)||null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDomNodeProfile=function(e){return{action:e.action,class:e.className,href:o(e,"href"),id:o(e,"id"),event_key:o(e,"data-event-key"),method:e.method,name:e.name,node_name:e.nodeName,selector:(0,r.getDomNodePath)(e),text:o(e,"text"),title:o(e,"title"),type:e.type,x_position:e.offsetLeft||e.clientLeft||null,y_position:e.offsetTop||e.clientTop||null}};var r=n(10);var o=function e(t,n){return t[n]?t[n]:t.hasAttribute&&t.hasAttribute(n)?t.getAttribute(n):t.parentNode?e(t.parentNode,n):null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDomainName=function(e){var t=function(e){var t;t=e.indexOf("://")>-1?e.split("/")[2]:e.split("/")[0];return t=(t=t.split(":")[0]).split("?")[0]}(e),n=t.split("."),r=n.length;r>2&&(t=n[r-2]+"."+n[r-1],2==n[r-2].length&&2==n[r-1].length&&(t=n[r-3]+"."+t));return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getDatetimeIndex=function(e){var t=e||new Date;return{hour_of_day:t.getHours(),day_of_week:parseInt(1+t.getDay()),day_of_month:t.getDate(),month:parseInt(1+t.getMonth()),year:t.getFullYear()}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBrowserProfile=function(){return{cookies:void 0!==navigator.cookieEnabled&&navigator.cookieEnabled,codeName:navigator.appCodeName,description:function(){var e;document&&"function"==typeof document.querySelector&&(e=document.querySelector('meta[name="description"]'));return e?e.content:""}(),language:navigator.language,name:navigator.appName,online:navigator.onLine,platform:navigator.platform,useragent:navigator.userAgent,version:navigator.appVersion,doNotTrack:navigator.doNotTrack,screen:(0,r.getScreenProfile)(),window:(0,o.getWindowProfile)()}};var r=n(12),o=n(11)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0?f:a(l),time_on_page_ms:d>0?d:u(l)},ip_address:"${keen.ip}",geo:{},user_agent:"${keen.user_agent}",tech:{profile:e},url:{full:window?window.location.href:"",info:{}},referrer:{initial:b,full:document?document.referrer:"",info:{}},time:{local:{},utc:{}},keen:{timestamp:(new Date).toISOString(),addons:_}}}),!0===c.recordClicks&&i.listener("a, a *").on("click",function(e){var t=e.target,i={element:o.getDomNodeProfile(t),local_time_full:(new Date).toISOString()};if(!0===c.recordClicksPositionPointer){var s={x_position:e.pageX,y_position:e.pageY};i=r({},i,{pointer:s})}return c.catchError?n.recordEvent({collection:"clicks",event:i}).catch(function(e){c.catchError(e)}):n.recordEvent({collection:"clicks",event:i})}),!0===c.recordFormSubmits&&i.listener("form").on("submit",function(e){var t=e.target,r={disabled:c.ignoreDisabledFormFields,ignoreTypes:c.ignoreFormFieldTypes},s={form:{action:t.action,fields:i.serializeForm(t,r),method:t.method},element:o.getDomNodeProfile(t),local_time_full:(new Date).toISOString()};return c.catchError?n.recordEvent({collection:"form_submissions",event:s}).catch(function(e){c.catchError(e)}):n.recordEvent({collection:"form_submissions",event:s})}),!0!==c.recordPageViews||c.recordPageViewsOnExit||(c.catchError?n.recordEvent({collection:"pageviews"}).catch(function(e){c.catchError(e)}):n.recordEvent({collection:"pageviews"})),c.recordPageViewsOnExit&&"undefined"!=typeof window&&window.addEventListener("beforeunload",function(){n.config.requestType="beaconAPI",n.recordEvent({collection:"pageviews"})}),!0===c.recordElementViews&&"undefined"!=typeof IntersectionObserver){var x=new IntersectionObserver(function(e,t){e.forEach(function(e){if(e.isIntersecting){var t={element:o.getDomNodeProfile(e.target),local_time_full:(new Date).toISOString()};return c.catchError?n.recordEvent({collection:"element_views",event:t}).catch(function(e){c.catchError(e)}):n.recordEvent({collection:"element_views",event:t})}})},{threshold:1}),E=document.querySelectorAll(".track-element-view");E.forEach(function(e){x.observe(e)}),n.observers.IntersectionObserver=x}return n}};var o,i=n(7),s=(o=i)&&o.__esModule?o:{default:o};function a(e){return Math.round(u(e)/1e3)}function u(e){return(new Date).getTime()-e.getTime()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t0){e.queue.pause();var t=r({},e.queue.config),n=r({},e.queue.events);e.queue=(0,s.queue)(),e.queue.config=t,e.queue.on("flush",function(){e.recordDeferredEvents()}),e.emit("recordDeferredEvents",n),e.recordEvents(n,function(t,r){t&&e.emit("recordDeferredEventsError",t,n)})}return e};a(n(9));var i=a(n(0)),s=n(18);function a(e){return e&&e.__esModule?e:{default:e}}function u(e){this.emit("error","Event(s) not deferred: "+e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFromCache=t.saveToCache=void 0;var r=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:{};return a?Promise.resolve():s?(u=r({},u,e),new Promise(function(e,t){var n=self.indexedDB.open(u.dbName);n.onerror=function(t){s=!1,e()},n.onupgradeneeded=function(e){var t=e.target.result.createObjectStore(u.dbCollectionName,{keyPath:u.dbCollectionKey});t.createIndex(u.dbCollectionKey,u.dbCollectionKey,{unique:!0}),t.createIndex("expiryTime","expiryTime",{unique:!1})},n.onsuccess=function(t){(a=t.target.result).onerror=function(e){s=!1},e(a)}})):Promise.resolve()}t.saveToCache=function(e){return c(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).then(function(){var t=a.transaction(u.dbCollectionName,"readwrite").objectStore(u.dbCollectionName).add({hash:e,expiryTime:Date.now()+u.maxAge});t.onsuccess=function(e){},t.onerror=function(e){s=!1}})},t.getFromCache=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(n).then(function(){return new Promise(function(r,o){if(!s)return r(null);var i=a.transaction(u.dbCollectionName,"readwrite").objectStore(u.dbCollectionName).index("expiryTime"),c=IDBKeyRange.upperBound(Date.now(),!0);i.openCursor(c).onsuccess=function(e){var t=e.target.result;if(t){a.transaction(u.dbCollectionName,"readwrite").objectStore(u.dbCollectionName).delete(e.target.result.value[u.dbCollectionKey]);t.continue()}};var l=a.transaction(u.dbCollectionName,"readwrite").objectStore(u.dbCollectionName).index(u.dbCollectionKey).get(t);l.onsuccess=function(o){if(!o.target.result||o.target.result.expiryTimep})}var h=u.find(function(e){return e.hash===l});if(h){if(!(h.expiryTime&&h.expiryTime0?d():o(e)}).catch(function(e){if(e.code===DOMException.ABORT_ERR)return o(i.default.REQUEST_ABORTED);s>0?d():o(e)})};function d(){c+=1,setTimeout(function(){f(s-c)},2^c*a)}f(s-c)});return f.abort=function(){l.abort()},f},n(2),n(6);var o=s(n(3)),i=s(n(34));function s(e){return e&&e.__esModule?e:{default:e}}},function(e,t){e.exports={map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){"use strict";var t,n,r,o,i,s,a,u="",c=0,l=this.map;for(e=this.utf8.encode(e);c>2,i=(3&t)<<4|n>>4,s=isNaN(n)?64:(15&n)<<2|r>>6,a=isNaN(n)||isNaN(r)?64:63&r,u=u+l.charAt(o)+l.charAt(i)+l.charAt(s)+l.charAt(a);return u},decode:function(e){"use strict";var t,n,r,o,i,s,a="",u=0,c=this.map,l=String.fromCharCode;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u>2,s=(3&r)<<6|(o=c.indexOf(e.charAt(u++))),a=a+(l(t<<2|n>>4)+(64!=r?l(i):""))+(64!=o?l(s):"");return this.utf8.decode(a)},utf8:{encode:function(e){"use strict";for(var t,n="",r=0,o=String.fromCharCode;r127&&t<2048?o(t>>6|192)+o(63&t|128):o(t>>12|224)+o(t>>6&63|128)+o(63&t|128);return n},decode:function(e){"use strict";for(var t,n="",r=0,o=String.fromCharCode;r191&&t<224?[o((31&t)<<6|63&e.charCodeAt(r+1)),r+=2][0]:[o((15&t)<<12|(63&e.charCodeAt(r+1))<<6|63&(c3=e.charCodeAt(r+2))),r+=3][0];return n}}}},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var u,c=[],l=!1,f=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=a(d);l=!0;for(var t=c.length;t;){for(u=c,c=[];++f1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(38),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(4))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t2)return void m.call(this,"Incorrect arguments provided to #recordEvents method",t);var i={};if((0,s.default)(e,function(e,t){i[t]=i[t]||[],(0,s.default)(e,function(e,r){var o={};(0,l.getExtendedEventBody)(o,n.extensions.events),(0,l.getExtendedEventBody)(o,n.extensions.collections[t]),(0,l.getExtendedEventBody)(o,[e]),i[t].push(o)})}),this.emit("recordEvents",i),!u.default.enabled)return m.call(this,"Keen.enabled is set to false.",t),!1;if(u.default.optedOut)return Promise.resolve({created:!1,message:"Keen.optedOut is set to true."});if(u.default.doNotTrack)return Promise.resolve({created:!1,message:"Keen.doNotTrack is set to true."});return h.call(this,{url:r,extendedEventsHash:i,callback:t})},n(2),n(6);var i=p(n(36)),s=p(n(0)),a=p(n(1)),u=p(n(9)),c=n(7),l=n(15),f=p(n(35)),d=p(n(33));function p(e){return e&&e.__esModule?e:{default:e}}function h(e){var t=e.url,n=e.extendedEventsHash,r=e.callback,o=e.configObject,s=void 0===o?{}:o,a=e.eventCollection,u=(this.config,s.requestType||this.config.requestType);if(navigator&&navigator.sendBeacon&&"beaconAPI"===u)return navigator.sendBeacon(t+"?api_key="+this.writeKey(),JSON.stringify(n)),r&&r(),this;if("beacon"===u||"img"===u){var l=this.url("events",encodeURIComponent(a),{api_key:this.writeKey(),data:encodeURIComponent(i.default.encode(JSON.stringify(n))),modified:(new Date).getTime()});return l.length0))return 1900;return 16e3}()?function(e,t){var n=this,r=document.createElement("img");r.onload=function(){if(!0,"naturalHeight"in this){if(this.naturalHeight+this.naturalWidth===0)return void this.onerror()}else if(this.width+this.height===0)return void this.onerror();t&&t.call(n)},r.onerror=function(){!0,t&&t.call(n,"An error occurred!",null)},r.src=e+"&c=clv1"}.call(this,l,r):r&&r("Beacon URL length exceeds current browser limit, and XHR is not supported.",null),this}return"undefined"!=typeof fetch?function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=this,i=(0,f.default)(t,{method:e,body:n?JSON.stringify(n):"",mode:"cors",redirect:"follow",referrerPolicy:o.referrerPolicy()||"unsafe-url",headers:{Authorization:o.writeKey(),"Content-Type":"application/json","keen-sdk":"javascript-"+c.version},retry:o.config.retry});return i.catch(function(e){return void 0!==r&&r.call(o,e,null),o.emit("error",e),Promise.reject(e)}).then(function(e){return e.ok?e.json():e.json().then(function(t){return Promise.reject({error_code:t.error_code,body:t.message,status:e.status,ok:!1,statusText:e.statusText})})}).then(function(e){return(void 0!==(t=e).created?t.created:0===Object.keys(t).map(function(e){return t[e].filter(function(e){return!e.success})}).filter(function(e){return e.length>0}).length)?(void 0!==r&&r.call(o,null,e),Promise.resolve(e)):(void 0!==r&&r.call(o,e,null),o.emit("error",e),Promise.reject(e));var t}),i}.call(this,"POST",t,n,r):this}function v(e){return this.projectId()?!!this.writeKey()||(m.call(this,"Keen.Client is missing a writeKey property.",e),!1):(m.call(this,"Keen.Client is missing a projectId property.",e),!1)}function m(e,t){var n="Event(s) not recorded: "+e;this.emit("error",n),t&&t.call(this,n,null)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.listenerCore=void 0;o(n(8));var r=o(n(0));function o(e){return e&&e.__esModule?e:{default:e}}t.listenerCore=function(e){function t(e){if(e)return this instanceof t==!1?new t(e):(this.selector=e,this)}return e.domListeners=e.domListeners||{},t.prototype.on=function(t,n){var o;return 2!==arguments.length||"string"!=typeof t||"function"!=typeof n?this:(void 0===e.domListeners[t]&&(!function(e,t){document.addEventListener?document.addEventListener(e,t,!1):document.attachEvent("on"+e,t)}(t,(o=t,function(t){var n,i;n=t||window.event,i=n.target||n.srcElement,"undefined"!==e.domListeners[o]&&(0,r.default)(e.domListeners[o],function(e,t){!function(e,t){for(var n=(e.parentNode||document).querySelectorAll(t)||[],r=n.length;r--;)if(n[r]==e)return!0;return!1}(i,t)?"window"===t&&(0,r.default)(e,function(e,t){e(n)}):(0,r.default)(e,function(e,t){"click"===o&&"A"===i.nodeName?function(e,t,n){var r,o;if(void 0!==t.getAttribute?r=t.getAttribute("target"):t.target&&(r=t.target),"boolean"==typeof(o=n(e))&&!1===o||e.defaultPrevented||!1===e.returnValue)return e.preventDefault&&e.preventDefault(),e.returnValue=!1,!1;if("_blank"!==r&&"blank"!==r&&!e.metaKey&&!t.hasAttribute("download")&&(e.preventDefault&&e.preventDefault(),e.returnValue=!1,t.href&&"#"!==t.href&&t.href!==window.location+"#"))if(void 0!==o){if(navigator&&navigator.sendBeacon)return void(window.location=t.href);o.then(function(){window.location=t.href}).catch(function(e){window.location=t.href})}else setTimeout(function(){window.location=t.href},500)}(n,i,e):"submit"===o&&"FORM"===i.nodeName?function(e,t,n){var r=n(e);if("boolean"==typeof r&&!1===r||e.defaultPrevented||!1===e.returnValue)return e.preventDefault&&e.preventDefault(),e.returnValue=!1,!1;if(e.preventDefault&&e.preventDefault(),e.returnValue=!1,void 0!==r){if(navigator&&navigator.sendBeacon)return void t.submit();r.then(function(){t.submit()}).catch(function(e){t.submit()})}else setTimeout(function(){t.submit()},500)}(n,i,e):e(n)})})})),e.domListeners[t]={}),e.domListeners[t][this.selector]=e.domListeners[t][this.selector]||[],e.domListeners[t][this.selector].push(n),this)},t.prototype.once=function(e,t){var n=this;function r(){return n.off(e,r),t.apply(n,arguments)}return r.fn=t,n.on(e,r),n},t.prototype.off=function(t,n){var o=this,i=[];if(2===arguments.length)(0,r.default)(e.domListeners[t][o.selector],function(e,t){e!==n&&e.fn!==n&&i.push(e)}),e.domListeners[t][o.selector]=i;else if(1===arguments.length)try{delete e.domListeners[t][o.selector]}catch(n){e.domListeners[t][o.selector]=[]}else(0,r.default)(e.domListeners,function(t,n){try{delete e.domListeners[n][o.selector]}catch(t){e.domListeners[n][o.selector]=function(){}}});return o},t}},function(e,t,n){var r=n(0);n(1);e.exports=function(e){var t=[];return r(e,function(e,n){"string"!=typeof e&&(e=JSON.stringify(e)),t.push(n+"="+encodeURIComponent(e))}),t.join("&")}},function(e,t){e.exports=function(e){var t,n={},r=/\+/g,o=/([^&=]+)=?([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(r," "))},s=e.split("?")[1];for(;t=o.exec(s);)n[i(t[1])]=i(t[2]);return n}},function(e,t,n){(function(t){(function(t){var r=t.Keen||void 0,o=n(0),i=n(1),s=n(43),a=n(42),u=n(8);function c(e){if(this instanceof c==!1)return new c(e);this.configure(e),c.debug&&this.on("error",c.log),this.emit("ready"),c.emit("client",this)}function l(e){return void 0!==e}r&&void 0===r.resources&&(c.legacyVersion=r),u(c),u(c.prototype),i(c,{debug:!1,enabled:!0,loaded:!1,version:"__VERSION__"}),c.helpers=c.helpers||{},c.resources=c.resources||{},i(c.resources,{base:"{protocol}://{host}",version:"{protocol}://{host}/3.0",projects:"{protocol}://{host}/3.0/projects",projectId:"{protocol}://{host}/3.0/projects/{projectId}",events:"{protocol}://{host}/3.0/projects/{projectId}/events",queries:"{protocol}://{host}/3.0/projects/{projectId}/queries"}),c.utils=c.utils||{},i(c.utils,{each:o,extend:i,parseParams:s,serialize:a}),c.extendLibrary=function(e,t){var n=r||t;return l(n)&&l(n.resources)&&(o(n,function(t,n){"object"==typeof t?(e[n]=e[n]||{},i(e[n],t)):e[n]=e[n]||t}),i(e.prototype,n.prototype)),e},c.log=function(e){c.debug&&"object"==typeof console&&console.log("[Keen]",e)},c.noConflict=function(){return void 0!==t.Keen&&(t.Keen=c.legacyVersion||r),c},c.ready=function(e){c.loaded?e():c.once("ready",e)},c.prototype.configure=function(e){var t=e||{};return this.config=this.config||{projectId:void 0,writeKey:void 0,host:"api.keen.io",protocol:"https",requestType:"jsonp",resources:i({},c.resources)},"undefined"!=typeof window&&window.navigator&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1&&(t.protocol=document.location.protocol.replace(":","")),t.host&&t.host.replace(/.*?:\/\//g,""),i(this.config,t),this},c.prototype.masterKey=function(e){return arguments.length?(this.config.masterKey=e?String(e):null,this):this.config.masterKey},c.prototype.projectId=function(e){return arguments.length?(this.config.projectId=e?String(e):null,this):this.config.projectId},c.prototype.resources=function(e){if(!arguments.length)return this.config.resources;var t=this;return"object"==typeof e&&o(e,function(e,n){t.config.resources[n]=e||null}),t},c.prototype.url=function(e){var t,n=Array.prototype.slice.call(arguments,1),r=this.config.resources.base||"{protocol}://{host}";return t=e&&"string"==typeof e?this.config.resources[e]?this.config.resources[e]:r+e:r,o(this.config,function(e,n){"object"!=typeof e&&(t=t.replace("{"+n+"}",e))}),o(n,function(e,n){"string"==typeof e?t+="/"+e:"object"==typeof e&&(t+="?",o(e,function(e,n){t+=n+"="+e+"&"}),t=t.slice(0,-1))}),t},function(e){if(c.loaded||"undefined"==typeof document)return void e();null==document.readyState&&document.addEventListener&&(document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e,!1),document.readyState="complete"},!1),document.readyState="loading");!function e(t){/in/.test(document.readyState)?setTimeout(function(){e(t)},9):t()}(e)}(function(){c.loaded=!0,c.emit("ready")}),e.exports=c}).call(this,"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{})}).call(this,n(4))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeenTracking=t.Keen=t.keenGlobals=void 0;var r=j(n(9)),o=j(n(0)),i=j(n(1)),s=n(41),a=n(40),u=n(31),c=n(15),l=n(30),f=n(29),d=n(28),p=n(27),h=n(10),v=n(26),m=n(12),y=n(25),g=n(24),b=n(11),w=n(23),_=n(14),x=n(21),E=n(20),k=n(17),O=n(16);function j(e){return e&&e.__esModule?e:{default:e}}(0,i.default)(r.default.prototype,{recordEvent:a.recordEvent,recordEvents:a.recordEvents}),(0,i.default)(r.default.prototype,{deferEvent:u.deferEvent,deferEvents:u.deferEvents,queueCapacity:u.queueCapacity,queueInterval:u.queueInterval,recordDeferredEvents:u.recordDeferredEvents,setOptOut:k.setOptOut}),(0,i.default)(r.default.prototype,{extendEvent:c.extendEvent,extendEvents:c.extendEvents});var T=(0,l.initAutoTrackingCore)(r.default);(0,i.default)(r.default.prototype,{initAutoTracking:T}),(0,i.default)(r.default.helpers,{getBrowserProfile:f.getBrowserProfile,getDatetimeIndex:d.getDatetimeIndex,getDomainName:p.getDomainName,getDomNodePath:h.getDomNodePath,getDomNodeProfile:v.getDomNodeProfile,getScreenProfile:m.getScreenProfile,getScrollState:y.getScrollState,getUniqueId:g.getUniqueId,getWindowProfile:b.getWindowProfile});var P=(0,s.listenerCore)(r.default);(0,i.default)(r.default.utils,{cookie:w.cookie,deepExtend:_.deepExtend,listener:P,serializeForm:x.serializeForm,timer:E.timer}),r.default.listenTo=function(e){(0,o.default)(e,function(e,t){var n=t.split(" "),r=n[0],o=n.slice(1,n.length).join(" ");return P(o).on(r,e)})};t.keenGlobals=void 0;"undefined"!=typeof webpackKeenGlobals&&(t.keenGlobals=webpackKeenGlobals),O.isLocalStorageAvailable&&localStorage.getItem("optout")&&(r.default.optedOut=!0),"1"!==navigator.doNotTrack&&"yes"!==navigator.doNotTrack||(r.default.doNotTrack=!0);var S=t.Keen=r.default.extendLibrary(r.default);t.KeenTracking=S;t.default=S},function(e,t,n){e.exports=n(45)}])}); //# sourceMappingURL=keen-tracking.min.js.map /* eslint-env browser */ /* global KeenTracking */ (function (w) { KeenTracking.ready(function () { if (typeof w.peachyEvent !== 'undefined') { return; } var pel = document.getElementById('peachy-fine'); var client = new KeenTracking({ host: 'peachy.prod.mirus.io/record', projectId: pel.getAttribute('data-peachy-projectid') || '', writeKey: pel.getAttribute('data-peachy-writekey') || '', requestType: 'xhr', // makes testing a lot easier }); client.extendEvents(function () { var val = pel && pel.getAttribute('data-peachy'); return { __passthrough: val }; }); client.initAutoTracking({ collectUuid: false, // turn off the uuid session cookie ignoreDisabledFormFields: false, ignoreFormFieldTypes: ['password'], recordClicks: true, recordFormSubmits: true, recordPageViews: true, recordScrollState: true, }); // w.peachyEvent = window.client.recordEvent.bind(this); w.peachyEvent = function () { client.recordEvent.apply(client, arguments); }; }); })(window);