From 15b74f7ec32a3f223a9f60cc452a399b77f1f935 Mon Sep 17 00:00:00 2001 From: turtledreams <62231246+turtledreams@users.noreply.github.com> Date: Thu, 9 Nov 2023 22:07:45 +0900 Subject: [PATCH] vers (#449) --- examples/react/package.json | 2 +- lib/countly.js | 2 +- lib/countly.min.js | 235 ++++++++++++++++++------------------ package.json | 2 +- 4 files changed, 121 insertions(+), 120 deletions(-) diff --git a/examples/react/package.json b/examples/react/package.json index 22bfcf2d..d1aeaf8c 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "countly-sdk-web": "^23.6.2" + "countly-sdk-web": "^23.6.3" }, "devDependencies": { "react": "^18.2.0", diff --git a/lib/countly.js b/lib/countly.js index 15529cd9..0e67a01b 100644 --- a/lib/countly.js +++ b/lib/countly.js @@ -194,7 +194,7 @@ */ Countly.onload = Countly.onload || []; - var SDK_VERSION = "23.6.2"; + var SDK_VERSION = "23.6.3"; var SDK_NAME = "javascript_native_web"; // Using this on document.referrer would return an array with 15 elements in it. The 12th element (array[11]) would be the path we are looking for. Others would be things like password and such (use https://regex101.com/ to check more) diff --git a/lib/countly.min.js b/lib/countly.min.js index 61403055..659a0ddb 100644 --- a/lib/countly.min.js +++ b/lib/countly.min.js @@ -1,150 +1,151 @@ -(function(m,ta){"function"===typeof define&&define.amd?define([],function(){return ta(m.Countly)}):"object"===typeof module&&module.exports?module.exports=ta(m.Countly):m.Countly=ta(m.Countly)})("undefined"!==typeof window?window:this,function(m){function ta(h){var p=document.createElement("script"),t=document.createElement("script");p.async=!0;t.async=!0;p.src=m.customSourceBoomerang||mb.BOOMERANG_SRC;t.src=m.customSourceCountlyBoomerang||mb.CLY_BOOMERANG_SRC;document.getElementsByTagName("head")[0].appendChild(p); -document.getElementsByTagName("head")[0].appendChild(t);var A=!1,B=!1;p.onload=function(){A=!0};t.onload=function(){B=!0};var M=0,U=setInterval(function(){M+=50;if(A&&B||1500<=M){if(m.debug){var R="BoomerangJS loaded:["+A+"], countly_boomerang loaded:["+B+"].";A&&B?console.log("[DEBUG] "+R):console.warn("[WARNING] "+R+" Initializing without APM.")}m.init(h);clearInterval(U)}},50)}function nb(h){var p=[];if("undefined"!==typeof h.options)for(var t=0;t=h?Ha++:Ha=h;return Ha}function r(h,p,t){if(p&&Object.keys(p).length){if("undefined"!== -typeof p[h])return p[h]}else if("undefined"!==typeof m[h])return m[h];return t}function $a(h,p,t){for(var A in m.i)m.i[A].tracking_crashes&&m.i[A].recordError(h,p,t)}function pb(h){var p=[],t;for(t in h)p.push(t+"="+encodeURIComponent(h[t]));return p.join("&")}function na(h){return"string"===typeof h&&"/"===h.substring(h.length-1)?h.substring(0,h.length-1):h}function ua(h,p){for(var t={},A,B=0,M=p.length;BA){var R={},va=0,Z;for(Z in h)vap&&(B=h.substring(0,p),A(d.DEBUG,t+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return B}function oa(h){if(h)return h;h=navigator.userAgent;!h&&navigator.userAgentData&&(h=navigator.userAgentData.brands.map(function(p){return p.brand+ -":"+p.version}).join(),h+=navigator.userAgentData.mobile?" mobi ":" ",h+=navigator.userAgentData.platform);return h}function qb(h){if(!h){if(navigator.userAgentData.mobile)return"phone";h=oa()}h=h.toLowerCase();var p="desktop",t=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(h)? -p="tablet":t.test(h)&&(p="phone");return p}function rb(h){return/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO|contxbot|PingdomBot|BingPreview|HeadlessChrome)/.test(h|| -oa())}function ab(h){"undefined"===typeof h.pageY&&"number"===typeof h.clientX&&document.documentElement&&(h.pageX=h.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.pageY=h.clientY+document.body.scrollTop+document.documentElement.scrollTop);return h}function Ia(){var h=document;return Math.max(Math.max(h.body.scrollHeight,h.documentElement.scrollHeight),Math.max(h.body.offsetHeight,h.documentElement.offsetHeight),Math.max(h.body.clientHeight,h.documentElement.clientHeight))} -function bb(){var h=document;return Math.max(Math.max(h.body.scrollWidth,h.documentElement.scrollWidth),Math.max(h.body.offsetWidth,h.documentElement.offsetWidth),Math.max(h.body.clientWidth,h.documentElement.clientWidth))}function sb(){var h=document;return Math.min(Math.min(h.body.clientHeight,h.documentElement.clientHeight),Math.min(h.body.offsetHeight,h.documentElement.offsetHeight),window.innerHeight)}function tb(h,p,t,A,B,M){h=document.createElement(h);var U;h.setAttribute(p,t);h.setAttribute(A, -B);p=function(){U||M();U=!0};M&&(h.onreadystatechange=p,h.onload=p);document.getElementsByTagName("head")[0].appendChild(h)}function ub(h,p){tb("script","type","text/javascript","src",h,p)}function Ja(h,p){tb("link","rel","stylesheet","href",h,p)}function vb(){var h=document.getElementById("cly-loader");if(!h){var p=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css";t.styleSheet?t.styleSheet.cssText="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}": -t.appendChild(document.createTextNode("#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}")); -p.appendChild(t);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(m.showLoaderProtection)wa()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(h)}catch(A){wa()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+A)}}}h.style.display="block"}function wa(){return m&&m.debug&&"undefined"!==typeof console?!0:!1}function wb(){m.showLoaderProtection=!0;var h=document.getElementById("cly-loader"); -h&&(h.style.display="none")}if("undefined"!==typeof window){m=m||{};m.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");var I={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},Hb=Object.values(I),d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},mb={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js", -CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},P=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"});m.q=m.q||[];m.onload=m.onload||[];var xb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,yb=!0;m.CountlyClass= -function(h){function p(a,c){if(f.ignore_visitor)b(d.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);Hb.includes(a.key)||(a.key=x(a.key,f.maxKeyLength,"add_cly_event",b));a.segmentation=Y(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",b);a=ua(a,["key","count","sum","dur","segmentation"]);a.timestamp=Za();var e=new Date;a.hour=e.getHours();a.dow=e.getDay();a.id=c||Xa();a.key===I.VIEW?a.pvid=xa||"":a.cvid=fa||"";J.push(a); -u("cly_event",J);b(d.INFO,"With event ID: ["+a.id+"], successfully adding the last event:",a)}else b(d.ERROR,"Adding event failed. Event must have a key property")}function t(a,c,e,k,l){b(d.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var g={method:"rc",av:f.app_version};a&&(g.keys=JSON.stringify(a));c&&(g.omit_keys=JSON.stringify(c));var n;"legacy"===k&&(g.method="fetch_remote_config");0===e&&(g.oi=0);1===e&&(g.oi=1);"function"===typeof l&&(n=l);f.check_consent("sessions")&& -(g.metrics=JSON.stringify(Ka()));f.check_consent("remote-config")?(Z(g),aa("fetch_remote_config_explicit",f.url+La,g,function(q,v,K){if(q)b(d.ERROR,"fetch_remote_config_explicit, An error occurred: "+q);else{try{var S=JSON.parse(K);if(g.keys||g.omit_keys)for(var L in S)O[L]=S[L];else O=S;u("cly_remote_configs",O)}catch(pa){b(d.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+pa)}n&&(b(d.INFO,"fetch_remote_config_explicit, Callback function is provided"),n(q,O))}},!0)): -(b(d.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),n&&n(Error("Remote config requires explicit consent"),O))}function A(){f.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0);f.ignore_bots&&rb()&&(f.ignore_visitor=!0)}function B(){0=h?Ia++:Ia=h;return Ia}function r(h,p,u){if(p&&Object.keys(p).length){if("undefined"!== +typeof p[h])return p[h]}else if("undefined"!==typeof n[h])return n[h];return u}function bb(h,p,u){for(var A in n.i)n.i[A].tracking_crashes&&n.i[A].recordError(h,p,u)}function rb(h){var p=[],u;for(u in h)p.push(u+"="+encodeURIComponent(h[u]));return p.join("&")}function oa(h){return"string"===typeof h&&"/"===h.substring(h.length-1)?h.substring(0,h.length-1):h}function ua(h,p){for(var u={},A,B=0,L=p.length;BA){var R={},va=0,Z;for(Z in h)vap&&(B=h.substring(0,p),A(d.DEBUG,u+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return B}function pa(h){if(h)return h;h=navigator.userAgent;!h&&navigator.userAgentData&&(h=navigator.userAgentData.brands.map(function(p){return p.brand+ +":"+p.version}).join(),h+=navigator.userAgentData.mobile?" mobi ":" ",h+=navigator.userAgentData.platform);return h}function sb(h){if(!h){if(navigator.userAgentData.mobile)return"phone";h=pa()}h=h.toLowerCase();var p="desktop",u=/(mobi|ipod|phone|blackberry|opera mini|fennec|minimo|symbian|psp|nintendo ds|archos|skyfire|puffin|blazer|bolt|gobrowser|iris|maemo|semc|teashark|uzard)/;/(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(h)? +p="tablet":u.test(h)&&(p="phone");return p}function tb(h){return/(CountlySiteBot|nuhk|Googlebot|GoogleSecurityScanner|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver|bingbot|Google Web Preview|Mediapartners-Google|AdsBot-Google|Baiduspider|Ezooms|YahooSeeker|AltaVista|AVSearch|Mercator|Scooter|InfoSeek|Ultraseek|Lycos|Wget|YandexBot|Yandex|YaDirectFetcher|SiteBot|Exabot|AhrefsBot|MJ12bot|TurnitinBot|magpie-crawler|Nutch Crawler|CMS Crawler|rogerbot|Domnutch|ssearch_bot|XoviBot|netseer|digincore|fr-crawler|wesee|AliasIO|contxbot|PingdomBot|BingPreview|HeadlessChrome)/.test(h|| +pa())}function cb(h){"undefined"===typeof h.pageY&&"number"===typeof h.clientX&&document.documentElement&&(h.pageX=h.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,h.pageY=h.clientY+document.body.scrollTop+document.documentElement.scrollTop);return h}function Ja(){var h=document;return Math.max(Math.max(h.body.scrollHeight,h.documentElement.scrollHeight),Math.max(h.body.offsetHeight,h.documentElement.offsetHeight),Math.max(h.body.clientHeight,h.documentElement.clientHeight))} +function db(){var h=document;return Math.max(Math.max(h.body.scrollWidth,h.documentElement.scrollWidth),Math.max(h.body.offsetWidth,h.documentElement.offsetWidth),Math.max(h.body.clientWidth,h.documentElement.clientWidth))}function ub(){var h=document;return Math.min(Math.min(h.body.clientHeight,h.documentElement.clientHeight),Math.min(h.body.offsetHeight,h.documentElement.offsetHeight),window.innerHeight)}function vb(h,p,u,A,B,L){h=document.createElement(h);var T;h.setAttribute(p,u);h.setAttribute(A, +B);p=function(){T||L();T=!0};L&&(h.onreadystatechange=p,h.onload=p);document.getElementsByTagName("head")[0].appendChild(h)}function wb(h,p){vb("script","type","text/javascript","src",h,p)}function Ka(h,p){vb("link","rel","stylesheet","href",h,p)}function xb(){var h=document.getElementById("cly-loader");if(!h){var p=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText="#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}": +u.appendChild(document.createTextNode("#cly-loader {height: 4px; width: 100%; position: absolute; z-index: 99999; overflow: hidden; background-color: #fff; top:0px; left:0px;}#cly-loader:before{display: block; position: absolute; content: ''; left: -200px; width: 200px; height: 4px; background-color: #2EB52B; animation: cly-loading 2s linear infinite;}@keyframes cly-loading { from {left: -200px; width: 30%;} 50% {width: 30%;} 70% {width: 70%;} 80% { left: 50%;} 95% {left: 120%;} to {left: 100%;}}")); +p.appendChild(u);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(n.showLoaderProtection)wa()&&console.warn("[WARNING] [Countly] showloader, Loader is already on");else try{document.body.appendChild(h)}catch(A){wa()&&console.error("[ERROR] [Countly] showLoader, Body is not loaded for loader to append: "+A)}}}h.style.display="block"}function wa(){return n&&n.debug&&"undefined"!==typeof console?!0:!1}function yb(){n.showLoaderProtection=!0;var h=document.getElementById("cly-loader"); +h&&(h.style.display="none")}if("undefined"!==typeof window){n=n||{};n.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");var I={NPS:"[CLY]_nps",SURVEY:"[CLY]_survey",STAR_RATING:"[CLY]_star_rating",VIEW:"[CLY]_view",ORIENTATION:"[CLY]_orientation",ACTION:"[CLY]_action"},Jb=Object.values(I),d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "},ob={BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/boomerang.min.js", +CLY_BOOMERANG_SRC:"https://cdn.jsdelivr.net/npm/countly-sdk-web@latest/plugin/boomerang/countly_boomerang.js"},P=Object.freeze({errorCount:"cly_hc_error_count",warningCount:"cly_hc_warning_count",statusCode:"cly_hc_status_code",errorMessage:"cly_hc_error_message"});n.q=n.q||[];n.onload=n.onload||[];var zb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,Ab=!0;n.CountlyClass= +function(h){function p(a,c){if(f.ignore_visitor)b(d.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);Jb.includes(a.key)||(a.key=x(a.key,f.maxKeyLength,"add_cly_event",b));a.segmentation=Y(a.segmentation,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"add_cly_event",b);a=ua(a,["key","count","sum","dur","segmentation"]);a.timestamp=ab();var e=new Date;a.hour=e.getHours();a.dow=e.getDay();a.id=c||Za();a.key===I.VIEW?a.pvid=xa||"":a.cvid=fa||"";J.push(a); +v("cly_event",J);b(d.INFO,"With event ID: ["+a.id+"], successfully adding the last event:",a)}else b(d.ERROR,"Adding event failed. Event must have a key property")}function u(a,c,e,k,l){b(d.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var g={method:"rc",av:f.app_version};a&&(g.keys=JSON.stringify(a));c&&(g.omit_keys=JSON.stringify(c));var m;"legacy"===k&&(g.method="fetch_remote_config");0===e&&(g.oi=0);1===e&&(g.oi=1);"function"===typeof l&&(m=l);f.check_consent("sessions")&& +(g.metrics=JSON.stringify(La()));f.check_consent("remote-config")?(Z(g),aa("fetch_remote_config_explicit",f.url+Ma,g,function(q,t,K){if(q)b(d.ERROR,"fetch_remote_config_explicit, An error occurred: "+q);else{try{var N=JSON.parse(K);if(g.keys||g.omit_keys)for(var ka in N)O[ka]=N[ka];else O=N;v("cly_remote_configs",O)}catch(ya){b(d.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+ya)}m&&(b(d.INFO,"fetch_remote_config_explicit, Callback function is provided"),m(q,O))}}, +!0)):(b(d.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),m&&m(Error("Remote config requires explicit consent"),O))}function A(){f.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(f.ignore_visitor=!0);f.ignore_bots&&tb()&&(f.ignore_visitor=!0)}function B(){0a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;v.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;v.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;v.id="countly-feedback-sticker-"+a._id;g.appendChild(n);v.appendChild(g);v.appendChild(q);document.body.appendChild(v);var K=document.getElementById("smileyPathInStickerSvg"); -K&&(K.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);y(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(S){b(d.ERROR,"Somethings went wrong while element injecting process: "+ -S)}}function U(){var a;if("undefined"!==typeof f.onload&&0Ma&&F.shift(),F.push(a),u("cly_queue",F,!0)):b(d.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Na(){U();if(f.ignore_visitor)Oa=!1,b(d.WARNING,"User opt_out, no heartbeat");else{Oa=!0;var a=0;if(Pa&&"undefined"!==typeof m.q&&0Qa&&(f.session_duration(a-ia),ia=a,0cb&&(Ra=!1,a=F[0],a.rr=F.length,b(d.DEBUG,"Processing request",a),u("cly_queue",F,!0),f.test_mode||aa("send_request_queue",f.url+db,a,function(n,q){b(d.DEBUG,"Request Finished",q,n);n?(cb=E()+Sa,b(d.ERROR,"Request error: ",n)):F.shift();u("cly_queue",F,!0);Ra=!0},!1));setTimeout(Na,Ta)}}function eb(){var a=w("cly_id");return a?(C=w("cly_id_type"),a):Ya()}function zb(){return f.metrics._ua||oa()}function Ka(){var a= -JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||oa();if(screen.width){var c=screen.width?parseInt(screen.width):0,e=screen.height?parseInt(screen.height):0;if(0!==c&&0!==e){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)c=Math.round(c*window.devicePixelRatio),e=Math.round(e*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=c;c=e;e=k}a._resolution=a._resolution||""+c+"x"+e}}window.devicePixelRatio&& -(a._density=a._density||window.devicePixelRatio);c=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof c&&(a._locale=a._locale||c);fb()&&(a._store=a._store||document.referrer);b(d.DEBUG,"Got metrics",a);return a}function fb(a){a=a||document.referrer;var c=!1;if("undefined"===typeof a||0===a.length)b(d.DEBUG,"Invalid referrer:["+a+"], ignoring.");else{var e=xb.exec(a);if(e)if(e[11])if(e[11]===window.location.hostname)b(d.DEBUG,"Referrer is current host:["+ -a+"], ignoring.");else if(ba&&ba.length)for(c=!0,e=0;ea.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color;t.style.backgroundColor=7>a.trigger_bg_color.length?"#"+a.trigger_bg_color:a.trigger_bg_color;t.className="countly-feedback-sticker "+a.trigger_position+"-"+a.trigger_size;t.id="countly-feedback-sticker-"+a._id;g.appendChild(m);t.appendChild(g);t.appendChild(q);document.body.appendChild(t);var K=document.getElementById("smileyPathInStickerSvg"); +K&&(K.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);y(document.getElementById("countly-feedback-sticker-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block";document.getElementById("cfbg").style.display="block"})}else document.getElementById("countly-iframe-wrapper-"+a._id).style.display="block",document.getElementById("cfbg").style.display="block"}catch(N){b(d.ERROR,"Somethings went wrong while element injecting process: "+ +N)}}function T(){var a;if("undefined"!==typeof f.onload&&0Na&&F.shift(),F.push(a),v("cly_queue",F,!0)):b(d.ERROR,"app_key or device_id is missing ",f.app_key,f.device_id)}function Oa(){T();if(f.ignore_visitor)Pa=!1,b(d.WARNING,"User opt_out, no heartbeat");else{Pa=!0;var a=0;if(Qa&&"undefined"!==typeof n.q&&0Ra&&(f.session_duration(a-ia),ia=a,0eb&&(Sa=!1,a=F[0],a.rr=F.length,b(d.DEBUG,"Processing request",a),v("cly_queue",F,!0),f.test_mode||aa("send_request_queue",f.url+fb,a,function(m,q){b(d.DEBUG,"Request Finished",q,m);m?(eb=E()+Ta,b(d.ERROR,"Request error: ",m)):F.shift();v("cly_queue",F,!0);Sa=!0},!1));setTimeout(Oa,Ua)}}function gb(){var a=w("cly_id");return a?(C=w("cly_id_type"),a):$a()}function Bb(){return f.metrics._ua||pa()}function La(){var a= +JSON.parse(JSON.stringify(f.metrics||{}));a._app_version=a._app_version||f.app_version;a._ua=a._ua||pa();if(screen.width){var c=screen.width?parseInt(screen.width):0,e=screen.height?parseInt(screen.height):0;if(0!==c&&0!==e){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)c=Math.round(c*window.devicePixelRatio),e=Math.round(e*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=c;c=e;e=k}a._resolution=a._resolution||""+c+"x"+e}}window.devicePixelRatio&& +(a._density=a._density||window.devicePixelRatio);c=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof c&&(a._locale=a._locale||c);hb()&&(a._store=a._store||document.referrer);b(d.DEBUG,"Got metrics",a);return a}function hb(a){a=a||document.referrer;var c=!1;if("undefined"===typeof a||0===a.length)b(d.DEBUG,"Invalid referrer:["+a+"], ignoring.");else{var e=zb.exec(a);if(e)if(e[11])if(e[11]===window.location.hostname)b(d.DEBUG,"Referrer is current host:["+ +a+"], ignoring.");else if(ba&&ba.length)for(c=!0,e=0;ea))return b(d.ERROR,"Http response status code is not within the expected range:["+a+"]"),!1;try{var e=JSON.parse(c);return"[object Object]"!==Object.prototype.toString.call(e)? -(b(d.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Ab(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range: "+a),!1;try{var e=JSON.parse(c);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(d.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Cb(){Da=Math.max(Da, -window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)}function gb(){if(Ea){Ea=!1;var a=Ia(),c=bb(),e=sb();f.check_consent("scrolls")&&(a={type:"scroll",y:Da+e,width:c,height:a,view:f.getViewUrl()},a=Y(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),p({key:I.ACTION,segmentation:a}))}}function Db(a){u("cly_token",a)}function Eb(a,c,e){var k=new Date;k.setTime(k.getTime()+864E5*e);e="; expires="+ -k.toGMTString();document.cookie=a+"="+c+e+"; path=/"}function w(a,c,e){if("none"===f.storage)b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be retrieved");else{e||(a=f.app_key+"/"+a,f.namespace&&(a=na(f.namespace)+"/"+a));void 0===c&&(c=la);if(c)var k=localStorage.getItem(a);else if("localstorage"!==f.storage)a:{c=a+"=";e=document.cookie.split(";");k=0;for(var l=e.length;ka))return b(d.ERROR,"Http response status code is not within the expected range:["+a+"]"),!1;try{var e=JSON.parse(c);return"[object Object]"!==Object.prototype.toString.call(e)? +(b(d.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Cb(a,c){if(!(200<=a&&300>a))return b(d.ERROR,"Http response status code is not within the expected range: "+a),!1;try{var e=JSON.parse(c);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(b(d.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return b(d.ERROR,"Http response is not JSON: "+k),!1}}function Eb(){Ea=Math.max(Ea, +window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)}function ib(){if(Fa){Fa=!1;var a=Ja(),c=db(),e=ub();f.check_consent("scrolls")&&(a={type:"scroll",y:Ea+e,width:c,height:a,view:f.getViewUrl()},a=Y(a,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"processScrollView",b),f.track_domains&&(a.domain=window.location.hostname),p({key:I.ACTION,segmentation:a}))}}function Fb(a){v("cly_token",a)}function Gb(a,c,e){var k=new Date;k.setTime(k.getTime()+864E5*e);e="; expires="+ +k.toGMTString();document.cookie=a+"="+c+e+"; path=/"}function w(a,c,e){if("none"===f.storage)b(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be retrieved");else{e||(a=f.app_key+"/"+a,f.namespace&&(a=oa(f.namespace)+"/"+a));void 0===c&&(c=ma);if(c)var k=localStorage.getItem(a);else if("localstorage"!==f.storage)a:{c=a+"=";e=document.cookie.split(";");k=0;for(var l=e.length;kwindow.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,c){b(d.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,c)};this.recordDirectAttribution=function(a,c){b(d.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+a+"] and the user ID: ["+c+"]");this.check_consent("attribution")&&(a=a||w("cly_cmp_id")|| "cly_organic",(c=c||w("cly_cmp_uid"))?G({campaign_id:a,campaign_user:c}):G({campaign_id:a}))};this.user_details=function(a){b(d.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(B(),b(d.INFO,"user_details, flushed the event queue"),a.name=x(a.name,f.maxValueSize,"user_details",b),a.username=x(a.username,f.maxValueSize,"user_details",b),a.email=x(a.email,f.maxValueSize,"user_details",b),a.organization=x(a.organization,f.maxValueSize,"user_details",b),a.phone=x(a.phone, -f.maxValueSize,"user_details",b),a.picture=x(a.picture,4096,"user_details",b),a.gender=x(a.gender,f.maxValueSize,"user_details",b),a.byear=x(a.byear,f.maxValueSize,"user_details",b),a.custom=Y(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),G({user_details:JSON.stringify(ua(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var X={},ea=function(a,c,e){f.check_consent("users")&&(X[a]||(X[a]={}),"$push"===e||"$pull"===e||"$addToSet"=== -e?(X[a][e]||(X[a][e]=[]),X[a][e].push(c)):X[a][e]=c)};this.userData={set:function(a,c){b(d.INFO,"[userData] set, Setting user's custom property value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData set",b);c=x(c,f.maxValueSize,"userData set",b);X[a]=c},unset:function(a){b(d.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");X[a]=""},set_once:function(a,c){b(d.INFO,"[userData] set_once, Setting user's unique custom property value: ["+c+"] under the key: ["+ +f.maxValueSize,"user_details",b),a.picture=x(a.picture,4096,"user_details",b),a.gender=x(a.gender,f.maxValueSize,"user_details",b),a.byear=x(a.byear,f.maxValueSize,"user_details",b),a.custom=Y(a.custom,f.maxKeyLength,f.maxValueSize,f.maxSegmentationValues,"user_details",b),G({user_details:JSON.stringify(ua(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var W={},ea=function(a,c,e){f.check_consent("users")&&(W[a]||(W[a]={}),"$push"===e||"$pull"===e||"$addToSet"=== +e?(W[a][e]||(W[a][e]=[]),W[a][e].push(c)):W[a][e]=c)};this.userData={set:function(a,c){b(d.INFO,"[userData] set, Setting user's custom property value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData set",b);c=x(c,f.maxValueSize,"userData set",b);W[a]=c},unset:function(a){b(d.INFO,"[userData] unset, Resetting user's custom property with key: ["+a+"] ");W[a]=""},set_once:function(a,c){b(d.INFO,"[userData] set_once, Setting user's unique custom property value: ["+c+"] under the key: ["+ a+"] ");a=x(a,f.maxKeyLength,"userData set_once",b);c=x(c,f.maxValueSize,"userData set_once",b);ea(a,c,"$setOnce")},increment:function(a){b(d.INFO,"[userData] increment, Increasing user's custom property value under the key: ["+a+"] by one");a=x(a,f.maxKeyLength,"userData increment",b);ea(a,1,"$inc")},increment_by:function(a,c){b(d.INFO,"[userData] increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+c+"]");a=x(a,f.maxKeyLength,"userData increment_by",b);c=x(c,f.maxValueSize, "userData increment_by",b);ea(a,c,"$inc")},multiply:function(a,c){b(d.INFO,"[userData] multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+c+"]");a=x(a,f.maxKeyLength,"userData multiply",b);c=x(c,f.maxValueSize,"userData multiply",b);ea(a,c,"$mul")},max:function(a,c){b(d.INFO,"[userData] max, Saving user's maximum custom property value compared to the value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData max",b);c=x(c,f.maxValueSize,"userData max",b); ea(a,c,"$max")},min:function(a,c){b(d.INFO,"[userData] min, Saving user's minimum custom property value compared to the value: ["+c+"] under the key: ["+a+"]");a=x(a,f.maxKeyLength,"userData min",b);c=x(c,f.maxValueSize,"userData min",b);ea(a,c,"$min")},push:function(a,c){b(d.INFO,"[userData] push, Pushing a value: ["+c+"] under the key: ["+a+"] to user's custom property array");a=x(a,f.maxKeyLength,"userData push",b);c=x(c,f.maxValueSize,"userData push",b);ea(a,c,"$push")},push_unique:function(a, c){b(d.INFO,"[userData] push_unique, Pushing a unique value: ["+c+"] under the key: ["+a+"] to user's custom property array");a=x(a,f.maxKeyLength,"userData push_unique",b);c=x(c,f.maxValueSize,"userData push_unique",b);ea(a,c,"$addToSet")},pull:function(a,c){b(d.INFO,"[userData] pull, Removing the value: ["+c+"] under the key: ["+a+"] from user's custom property array");ea(a,c,"$pull")},save:function(){b(d.INFO,"[userData] save, Saving changes to user's custom property");f.check_consent("users")&& -(B(),b(d.INFO,"user_details, flushed the event queue"),G({user_details:JSON.stringify({custom:X})}));X={}}};this.report_trace=function(a){b(d.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var c="type name stz etz apm_metrics apm_attr".split(" "),e=0;e=f.maxBreadcrumbCount;)ma.shift(),b(d.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");ma.push(a)}};this.fetch_remote_config=function(a,c,e){var k=null,l=null,g=null;a&&(e||"function"!==typeof a?Array.isArray(a)&&(k=a):g=a); -c&&(e||"function"!==typeof c?Array.isArray(c)&&(l=c):g=c);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(d.INFO,"fetch_remote_config, Fetching remote config"),t(k,l,this.rcAutoOptinAb?1:0,null,g)):(b(d.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),t(k,l,null,"legacy",g))};this.enrollUserToAb=function(a){b(d.INFO,"enrollUserToAb, Providing AB test keys to opt in for");a&&Array.isArray(a)&&0!==a.length?(a={method:"ab",keys:JSON.stringify(a),av:f.app_version},Z(a), -aa("enrollUserToAb",this.url+La,a,function(c,e,k){if(c)b(d.ERROR,"enrollUserToAb, An error occurred: "+c);else try{var l=JSON.parse(k);b(d.DEBUG,"enrollUserToAb, Parsed the response's result: ["+l.result+"]")}catch(g){b(d.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(d.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(d.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?O[a]:O};this.stop_time=function(){b(d.INFO, -"stop_time, Stopping tracking duration");ka&&(ka=!1,ib=E()-ia,za=E()-ya)};this.start_time=function(){b(d.INFO,"start_time, Starting tracking duration");ka||(ka=!0,ia=E()-ib,ya=E()-za,za=0,va())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function c(){Ga>=Fa&&f.start_time();Ga=0}b(d.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();y(window,"beforeunload",function(){B();f.end_session()});var e= +(B(),b(d.INFO,"user_details, flushed the event queue"),G({user_details:JSON.stringify({custom:W})}));W={}}};this.report_trace=function(a){b(d.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var c="type name stz etz apm_metrics apm_attr".split(" "),e=0;e=f.maxBreadcrumbCount;)na.shift(),b(d.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");na.push(a)}};this.fetch_remote_config=function(a,c,e){var k=null,l=null,g=null;a&&(e||"function"!==typeof a?Array.isArray(a)&&(k=a):g=a); +c&&(e||"function"!==typeof c?Array.isArray(c)&&(l=c):g=c);g||"function"!==typeof e||(g=e);this.useExplicitRcApi?(b(d.INFO,"fetch_remote_config, Fetching remote config"),u(k,l,this.rcAutoOptinAb?1:0,null,g)):(b(d.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),u(k,l,null,"legacy",g))};this.enrollUserToAb=function(a){b(d.INFO,"enrollUserToAb, Providing AB test keys to opt in for");a&&Array.isArray(a)&&0!==a.length?(a={method:"ab",keys:JSON.stringify(a),av:f.app_version},Z(a), +aa("enrollUserToAb",this.url+Ma,a,function(c,e,k){if(c)b(d.ERROR,"enrollUserToAb, An error occurred: "+c);else try{var l=JSON.parse(k);b(d.DEBUG,"enrollUserToAb, Parsed the response's result: ["+l.result+"]")}catch(g){b(d.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+g)}},!0)):b(d.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){b(d.INFO,"get_remote_config, Getting remote config from storage");return"undefined"!==typeof a?O[a]:O};this.stop_time=function(){b(d.INFO, +"stop_time, Stopping tracking duration");la&&(la=!1,kb=E()-ia,Aa=E()-za)};this.start_time=function(){b(d.INFO,"start_time, Starting tracking duration");la||(la=!0,ia=E()-kb,za=E()-Aa,Aa=0,va())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?f.stop_time():f.start_time()}function c(){Ha>=Ga&&f.start_time();Ha=0}b(d.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();y(window,"beforeunload",function(){B();f.end_session()});var e= "hidden";y(window,"focus",a);y(window,"blur",a);y(window,"pageshow",a);y(window,"pagehide",a);"onfocusin"in document&&(y(window,"focusin",a),y(window,"focusout",a));e in document?document.addEventListener("visibilitychange",a):"mozHidden"in document?(e="mozHidden",document.addEventListener("mozvisibilitychange",a)):"webkitHidden"in document?(e="webkitHidden",document.addEventListener("webkitvisibilitychange",a)):"msHidden"in document&&(e="msHidden",document.addEventListener("msvisibilitychange",a)); -y(window,"mousemove",c);y(window,"click",c);y(window,"keydown",c);y(window,"scroll",c);setInterval(function(){Ga++;Ga>=Fa&&f.stop_time()},6E4)};this.track_pageview=function(a,c,e){b(d.INFO,"track_pageview, Tracking page views");b(d.VERBOSE,"track_pageview, last view is:["+V+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");V&&jb&&(b(d.DEBUG,"track_pageview, Scroll registry triggered"),gb(),Ea=!0,Da=0);R();xa=fa;fa=Xa();(a=x(a,f.maxKeyLength,"track_pageview",b))&&Array.isArray(a)&&(c= +y(window,"mousemove",c);y(window,"click",c);y(window,"keydown",c);y(window,"scroll",c);setInterval(function(){Ha++;Ha>=Ga&&f.stop_time()},6E4)};this.track_pageview=function(a,c,e){b(d.INFO,"track_pageview, Tracking page views");b(d.VERBOSE,"track_pageview, last view is:["+U+"], current view ID is:["+fa+"], previous view ID is:["+xa+"]");U&&lb&&(b(d.DEBUG,"track_pageview, Scroll registry triggered"),ib(),Fa=!0,Ea=0);R();xa=fa;fa=Za();(a=x(a,f.maxKeyLength,"track_pageview",b))&&Array.isArray(a)&&(c= a,a=null);a||(a=this.getViewName());if(void 0===a||""===a)b(d.ERROR,"track_pageview, No page name to track (it is either undefined or empty string). No page view can be tracked.");else if(null===a)b(d.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else{if(c&&c.length)for(var k=0;k