countly-sdk-web 23.12.1 → 23.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/cypress/integration/bridge_utils.js +1 -1
- package/lib/countly.js +2 -2
- package/lib/countly.min.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/countly.js
CHANGED
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
statusCode: "cly_hc_status_code",
|
|
197
197
|
errorMessage: "cly_hc_error_message"
|
|
198
198
|
});
|
|
199
|
-
var SDK_VERSION = "23.12.
|
|
199
|
+
var SDK_VERSION = "23.12.2";
|
|
200
200
|
var SDK_NAME = "javascript_native_web";
|
|
201
201
|
|
|
202
202
|
// 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)
|
|
@@ -581,7 +581,7 @@
|
|
|
581
581
|
*/
|
|
582
582
|
function userAgentSearchBotDetection(uaOverride) {
|
|
583
583
|
// search bot regexp
|
|
584
|
-
var searchBotRE = /(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)/;
|
|
584
|
+
var searchBotRE = /(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|Chrome-Lighthouse)/;
|
|
585
585
|
// true if the user agent string contains a search bot string pattern
|
|
586
586
|
return searchBotRE.test(uaOverride || currentUserAgentString());
|
|
587
587
|
}
|
package/lib/countly.min.js
CHANGED
|
@@ -4,7 +4,7 @@ function xb(l,k){for(var q=0;q<k.length;q++){var v=k[q];v.enumerable=v.enumerabl
|
|
|
4
4
|
Pa>=l?Pa++:Pa=l;return Pa}function t(l,k,q){if(k&&Object.keys(k).length){if("undefined"!==typeof k[l])return k[l]}else if("undefined"!==typeof p[l])return p[l];return q}function ib(l,k,q){for(var v in p.i)p.i[v].tracking_crashes&&p.i[v].recordError(l,k,q)}function ya(l){var k=[],q;for(q in l)k.push(q+"="+encodeURIComponent(l[q]));return k.join("&")}function ta(l){return"string"===typeof l&&"/"===l.substring(l.length-1)?l.substring(0,l.length-1):l}function za(l,k){for(var q={},v,G=0,Q=k.length;G<Q;G++)v=
|
|
5
5
|
k[G],"undefined"!==typeof l[v]&&(q[v]=l[v]);return q}function aa(l,k,q,v,G,Q){var O={};if(l){if(Object.keys(l).length>v){var U={},Aa=0,ma;for(ma in l)Aa<v&&(U[ma]=l[ma],Aa++);l=U}for(var Ba in l)v=z(Ba,k,G,Q),U=z(l[Ba],q,G,Q),O[v]=U}return O}function z(l,k,q,v){var G=l;"number"===typeof l&&(l=l.toString());"string"===typeof l&&l.length>k&&(G=l.substring(0,k),v(c.DEBUG,q+", Key: [ "+l+" ] is longer than accepted length. It will be truncated."));return G}function A(l,k,q){x&&(null===l||"undefined"===
|
|
6
6
|
typeof l?Ca()&&console.warn("[WARNING] [Countly] add_event_listener, Can't bind ["+k+"] event to nonexisting element"):"undefined"!==typeof l.addEventListener?l.addEventListener(k,q,!1):l.attachEvent("on"+k,q))}function Qa(l){return l?"undefined"!==typeof l.target?l.target:l.srcElement:window.event.srcElement}function ua(l){if(l)return l;l=navigator.userAgent;!l&&navigator.userAgentData&&(l=navigator.userAgentData.brands.map(function(k){return k.brand+":"+k.version}).join(),l+=navigator.userAgentData.mobile?
|
|
7
|
-
" mobi ":" ",l+=navigator.userAgentData.platform);return l}function Ab(l){if(!l){if(navigator.userAgentData.mobile)return"phone";l=ua()}l=l.toLowerCase();var k="desktop",q=/(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(l)?k="tablet":q.test(l)&&(k="phone");return k}function Bb(l){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(l||
|
|
7
|
+
" mobi ":" ",l+=navigator.userAgentData.platform);return l}function Ab(l){if(!l){if(navigator.userAgentData.mobile)return"phone";l=ua()}l=l.toLowerCase();var k="desktop",q=/(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(l)?k="tablet":q.test(l)&&(k="phone");return k}function Bb(l){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|Chrome-Lighthouse)/.test(l||
|
|
8
8
|
ua())}function jb(l){"undefined"===typeof l.pageY&&"number"===typeof l.clientX&&document.documentElement&&(l.pageX=l.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,l.pageY=l.clientY+document.body.scrollTop+document.documentElement.scrollTop);return l}function Ra(){var l=document;return Math.max(Math.max(l.body.scrollHeight,l.documentElement.scrollHeight),Math.max(l.body.offsetHeight,l.documentElement.offsetHeight),Math.max(l.body.clientHeight,l.documentElement.clientHeight))}
|
|
9
9
|
function kb(){var l=document;return Math.max(Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),Math.max(l.body.offsetWidth,l.documentElement.offsetWidth),Math.max(l.body.clientWidth,l.documentElement.clientWidth))}function Cb(){var l=document;return Math.min(Math.min(l.body.clientHeight,l.documentElement.clientHeight),Math.min(l.body.offsetHeight,l.documentElement.offsetHeight),window.innerHeight)}function Db(l,k,q,v,G,Q){l=document.createElement(l);var O;l.setAttribute(k,q);l.setAttribute(v,
|
|
10
10
|
G);k=function(){O||Q();O=!0};Q&&(l.onreadystatechange=k,l.onload=k);document.getElementsByTagName("head")[0].appendChild(l)}function Eb(l,k){Db("script","type","text/javascript","src",l,k)}function Sa(l,k){Db("link","rel","stylesheet","href",l,k)}function Fb(){if(x){var l=document.getElementById("cly-loader");if(!l){var k=document.head||document.getElementsByTagName("head")[0],q=document.createElement("style");q.type="text/css";q.styleSheet?q.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%;}}":
|
|
@@ -42,7 +42,7 @@ f.storage)a:{d=a+"=";e=document.cookie.split(";");h=0;for(var m=e.length;h<m;h++
|
|
|
42
42
|
L(f.storage)&&"function"===typeof f.storage.setItem?f.storage.setItem(a,d):(void 0===e&&(e=ra),d=f.serialize(d),e?localStorage.setItem(a,d):"localstorage"!==f.storage&&Ob(a,d,30))))}function X(a,d,e){"none"===f.storage||"object"!==L(f.storage)&&!x?b(c.DEBUG,"Storage is disabled. Value with key: "+a+" won't be removed"):(e||(a=f.app_key+"/"+a,f.namespace&&(a=ta(f.namespace)+"/"+a)),"object"===L(f.storage)&&"function"===typeof f.storage.removeItem?f.storage.removeItem(a):(void 0===d&&(d=ra),d?localStorage.removeItem(a):
|
|
43
43
|
"localstorage"!==f.storage&&Ob(a,"",-1)))}function Wb(){if(y(f.namespace+"cly_id",!1,!0)){w("cly_id",y(f.namespace+"cly_id",!1,!0));w("cly_id_type",y(f.namespace+"cly_id_type",!1,!0));w("cly_event",y(f.namespace+"cly_event",!1,!0));w("cly_session",y(f.namespace+"cly_session",!1,!0));var a=y(f.namespace+"cly_queue",!1,!0);Array.isArray(a)&&(a=a.filter(function(d){return d.app_key===f.app_key}),w("cly_queue",a));y(f.namespace+"cly_cmp_id",!1,!0)&&(w("cly_cmp_id",y(f.namespace+"cly_cmp_id",!1,!0)),w("cly_cmp_uid",
|
|
44
44
|
y(f.namespace+"cly_cmp_uid",!1,!0)));y(f.namespace+"cly_ignore",!1,!0)&&w("cly_ignore",y(f.namespace+"cly_ignore",!1,!0));X("cly_id",!1,!0);X("cly_id_type",!1,!0);X("cly_event",!1,!0);X("cly_session",!1,!0);X("cly_queue",!1,!0);X("cly_cmp_id",!1,!0);X("cly_cmp_uid",!1,!0);X("cly_ignore",!1,!0)}}if(!(this instanceof q))throw new TypeError("Cannot call a class as a function");var f=this,Ya=!p.i,V=!1,mb="/i",Ua="/o/sdk",bb=t("interval",k,500),Va=t("queue_size",k,1E3),H=[],J=[],R={},sa=[],da={},ca=t("ignore_referrers",
|
|
45
|
-
k,[]),sb=null,Ia=!0,ja,tb=0,W=null,Ga=0,Ha=0,lb=0,ab=t("fail_timeout",k,60),Na=t("inactivity_time",k,20),Oa=0,Za=t("session_update",k,60),Ka=t("max_events",k,100),wa=t("max_logs",k,null),ia=t("use_session_cookie",k,!0),Ja=t("session_cookie_timeout",k,30),$a=!0,Xa=!1,K=t("offline_mode",k,!1),ea={},pa=!0,Pb=F(),ra=!0,xa=null,D=1,Ma=!1,La=0,ub=!1,ha=null,Da=null,ka=null,va=t("sdk_name",k,"javascript_native_web"),oa=t("sdk_version",k,"23.12.
|
|
45
|
+
k,[]),sb=null,Ia=!0,ja,tb=0,W=null,Ga=0,Ha=0,lb=0,ab=t("fail_timeout",k,60),Na=t("inactivity_time",k,20),Oa=0,Za=t("session_update",k,60),Ka=t("max_events",k,100),wa=t("max_logs",k,null),ia=t("use_session_cookie",k,!0),Ja=t("session_cookie_timeout",k,30),$a=!0,Xa=!1,K=t("offline_mode",k,!1),ea={},pa=!0,Pb=F(),ra=!0,xa=null,D=1,Ma=!1,La=0,ub=!1,ha=null,Da=null,ka=null,va=t("sdk_name",k,"javascript_native_web"),oa=t("sdk_version",k,"23.12.2");try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(a){b(c.ERROR,
|
|
46
46
|
"Local storage test failed, Halting local storage support: "+a),ra=!1}for(var E={},vb=0;vb<p.features.length;vb++)E[p.features[vb]]={};this.initialize=function(){this.serialize=t("serialize",k,p.serialize);this.deserialize=t("deserialize",k,p.deserialize);this.getViewName=t("getViewName",k,p.getViewName);this.getViewUrl=t("getViewUrl",k,p.getViewUrl);this.getSearchQuery=t("getSearchQuery",k,p.getSearchQuery);this.DeviceIdType=p.DeviceIdType;this.namespace=t("namespace",k,"");this.clearStoredId=x?
|
|
47
47
|
t("clear_stored_id",k,!1):void 0;this.app_key=t("app_key",k,null);this.onload=t("onload",k,[]);this.utm=t("utm",k,{source:!0,medium:!0,campaign:!0,term:!0,content:!0});this.ignore_prefetch=t("ignore_prefetch",k,!0);this.rcAutoOptinAb=t("rc_automatic_optin_for_ab",k,!0);this.useExplicitRcApi=t("use_explicit_rc_api",k,!1);this.debug=t("debug",k,!1);this.test_mode=t("test_mode",k,!1);this.test_mode_eq=t("test_mode_eq",k,!1);this.metrics=t("metrics",k,{});this.headers=t("headers",k,{});this.url=ta(t("url",
|
|
48
48
|
k,""));this.app_version=t("app_version",k,"0.0");this.country_code=t("country_code",k,null);this.city=t("city",k,null);this.ip_address=t("ip_address",k,null);this.ignore_bots=x?t("ignore_bots",k,!0):void 0;this.force_post=t("force_post",k,!1);this.remote_config=t("remote_config",k,!1);this.ignore_visitor=t("ignore_visitor",k,!1);this.require_consent=t("require_consent",k,!1);this.track_domains=x?t("track_domains",k,!0):void 0;this.storage=t("storage",k,"default");this.enableOrientationTracking=x?
|
|
@@ -51,8 +51,8 @@ t("enable_orientation_tracking",k,!0):void 0;this.maxKeyLength=t("max_key_length
|
|
|
51
51
|
(b(c.ERROR,"initialize, Please provide server URL"),this.ignore_visitor=!0);y("cly_ignore")&&(this.ignore_visitor=!0);Wb();H=y("cly_queue")||[];J=y("cly_event")||[];R=y("cly_remote_configs")||{};this.clearStoredId&&(y("cly_id")&&!g&&(this.device_id=y("cly_id"),b(c.DEBUG,"initialize, temporarily using the previous device ID to flush existing events"),D=y("cly_id_type"),D||(b(c.DEBUG,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED, for event flushing"),
|
|
52
52
|
D=0),O(),this.device_id=void 0,D=1),b(c.INFO,"initialize, Clearing the device ID storage"),localStorage.removeItem(this.app_key+"/cly_id"),localStorage.removeItem(this.app_key+"/cly_id_type"),localStorage.removeItem(this.app_key+"/cly_session"));Q();if(x)if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",""))}catch(r){b(c.ERROR,"initialize, Could not parse name: "+window.name+", error: "+r)}else if(location.hash&&0===location.hash.indexOf("#cly:"))try{this.passed_data=
|
|
53
53
|
JSON.parse(location.hash.replace("#cly:",""))}catch(r){b(c.ERROR,"initialize, Could not parse hash: "+location.hash+", error: "+r)}if((this.passed_data&&this.passed_data.app_key&&this.passed_data.app_key===this.app_key||this.passed_data&&!this.passed_data.app_key&&Ya)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==y("cly_old_token")&&(Nb(this.passed_data.token),w("cly_old_token",this.passed_data.token));var a=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),
|
|
54
|
-
a=this.heatmapWhitelist.map(function(r){return ta(r)})):a=[this.url];a.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,Fb(),Eb(this.passed_data.url+"/views/heatmap.js",Gb))}if(this.ignore_visitor)b(c.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{"javascript_native_web"===va&&"23.12.
|
|
55
|
-
oa+"], default name:[javascript_native_web] and default version:[23.12.
|
|
54
|
+
a=this.heatmapWhitelist.map(function(r){return ta(r)})):a=[this.url];a.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,Fb(),Eb(this.passed_data.url+"/views/heatmap.js",Gb))}if(this.ignore_visitor)b(c.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");else{"javascript_native_web"===va&&"23.12.2"===oa?b(c.DEBUG,"initialize, SDK name:["+va+"], version:["+oa+"]"):b(c.DEBUG,"initialize, SDK name:["+va+"], version:["+
|
|
55
|
+
oa+"], default name:[javascript_native_web] and default version:[23.12.2]");b(c.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]");b(c.DEBUG,"initialize, device_id:["+t("device_id",k,void 0)+"]");b(c.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{b(c.DEBUG,"initialize, metric override:["+JSON.stringify(this.metrics)+"]"),b(c.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),b(c.DEBUG,"initialize, number of onload callbacks provided:["+
|
|
56
56
|
this.onload.length+"]"),b(c.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+"]"),ca&&b(c.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(ca)+"]")}catch(r){b(c.ERROR,"initialize, Could not stringify some config object values")}b(c.DEBUG,"initialize, app_version:["+this.app_version+"]");b(c.DEBUG,"initialize, provided location info; country_code:["+this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]");""!==this.namespace&&b(c.DEBUG,"initialize, namespace given:["+
|
|
57
57
|
this.namespace+"]");this.clearStoredId&&b(c.DEBUG,"initialize, clearStoredId flag set to:["+this.clearStoredId+"]");this.ignore_prefetch&&b(c.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]");this.test_mode&&b(c.WARNING,"initialize, test_mode:["+this.test_mode+"], request queue won't be processed");this.test_mode_eq&&b(c.WARNING,"initialize, test_mode_eq:["+this.test_mode_eq+"], event queue won't be processed");this.heatmapWhitelist&&
|
|
58
58
|
b(c.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted");"default"!==this.storage&&b(c.DEBUG,"initialize, storage is set to:["+this.storage+"]");this.ignore_bots&&b(c.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]");this.force_post&&b(c.DEBUG,"initialize, forced post method for all requests:["+this.force_post+"]");this.remote_config&&b(c.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+
|