countly-sdk-web 22.6.2 → 22.6.4
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/.markdownlint.json +1 -1
- package/CHANGELOG.md +6 -0
- package/README.md +35 -46
- package/countly-sdk-web-22.06.4.tgz +0 -0
- package/cypress/integration/crashes.js +36 -0
- package/cypress/support/commands.js +26 -0
- package/lib/countly.js +63 -30
- package/lib/countly.min.js +129 -130
- package/package.json +1 -1
- package/countly-sdk-web-22.06.2.tgz +0 -0
package/.markdownlint.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 22.06.4
|
|
2
|
+
- Fixed an issue with remote configs not working without a parameter
|
|
3
|
+
|
|
4
|
+
## 22.06.3
|
|
5
|
+
- Fixed an issue that arose when sending crashes through a gateway. User agent information is now sent as part of the request.
|
|
6
|
+
|
|
1
7
|
## 22.06.2
|
|
2
8
|
- ! Minor breaking change ! If no domain whitelist is provided for the heatmaps the SDK will fallback to your server url
|
|
3
9
|
- Fixed a bug where heatmap files were susceptible to DOM XSS
|
package/README.md
CHANGED
|
@@ -1,72 +1,61 @@
|
|
|
1
|
+
[](https://www.codacy.com/gh/Countly/countly-sdk-web/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Countly/countly-sdk-web&utm_campaign=Badge_Grade)
|
|
2
|
+
[](https://badge.fury.io/js/countly-sdk-web)
|
|
3
|
+
[](https://www.jsdelivr.com/package/npm/countly-sdk-web)
|
|
4
|
+
|
|
1
5
|
# Countly Web SDK
|
|
2
|
-
|
|
6
|
+
|
|
7
|
+
This repository contains the Countly Web SDK, which can be integrated into websites and web applications. The Countly Web SDK is intended to be used with [Countly Community Edition](https://github.com/Countly/countly-server) or [Countly Enterprise Edition](https://count.ly/product).
|
|
3
8
|
|
|
4
9
|
## What is Countly?
|
|
5
|
-
[Countly](
|
|
10
|
+
[Countly](https://count.ly) is a product analytics solution and innovation enabler that helps teams track product performance and customer journey and behavior across [mobile](https://count.ly/mobile-analytics), [web](http://count.ly/web-analytics),
|
|
11
|
+
and [desktop](https://count.ly/desktop-analytics) applications. [Ensuring privacy by design](https://count.ly/privacy-by-design), Countly allows you to innovate and enhance your products to provide personalized and customized customer experiences, and meet key business and revenue goals.
|
|
6
12
|
|
|
7
13
|
Track, measure, and take action - all without leaving Countly.
|
|
8
14
|
|
|
9
|
-
* **Slack user?** [Join our
|
|
10
|
-
* **Questions?** [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
There are 3 ways to get Countly SDK.
|
|
15
|
+
* **Slack user?** [Join our Slack Community](https://slack.count.ly)
|
|
16
|
+
* **Questions or feature requests?** [Post in our Community Forum](https://support.count.ly/hc/en-us/community/topics)
|
|
17
|
+
* **Looking for the Countly Server?** [Countly Community Edition repository](https://github.com/Countly/countly-server)
|
|
18
|
+
* **Looking for other Countly SDKs?** [An overview of all Countly SDKs for mobile, web and desktop](https://support.count.ly/hc/en-us/articles/360037236571-Downloading-and-Installing-SDKs#officially-supported-sdks)
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
Since Countly server 16.02, Countly Web SDK is available in your Countly server installation in `countly/frontend/express/public/sdk/web/countly.min.js` which should be available through URL as `https://yourserver.com/sdk/web/countly.min.js`
|
|
20
|
+
## Integrating Countly SDK in your projects
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
bower install countly-sdk-web
|
|
20
|
-
or
|
|
22
|
+
For a detailed description on how to use this SDK [check out our documentation](https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-).
|
|
21
23
|
|
|
22
|
-
|
|
23
|
-
or
|
|
24
|
+
For information about how to add the SDK to your project, please check [this section of the documentation](https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#adding-the-sdk-to-the-project).
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
You can reach minimal integration info for your website from [this section of the documentation](https://support.count.ly/hc/en-us/articles/360037441932-Web-analytics-JavaScript-#minimal-setup).
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
Countly web SDK is available on CDNJS:
|
|
28
|
+
Countly Web SDK has JSDoc3 compatible comments, and you can generate documentation by running `npm run-script docs` or you can use [the online version](https://countly.github.io/countly-sdk-web/).
|
|
29
29
|
|
|
30
|
-
[
|
|
30
|
+
For an example integration of this SDK, you can have a look [here](https://github.com/Countly/countly-sdk-web/tree/master/examples).
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
This SDK supports the following features:
|
|
33
|
+
* [Analytics](https://support.count.ly/hc/en-us/articles/4431589003545-Analytics)
|
|
34
|
+
* [User Profiles](https://support.count.ly/hc/en-us/articles/4403281285913-User-Profiles)
|
|
35
|
+
* [Crash Reports](https://support.count.ly/hc/en-us/articles/4404213566105-Crashes-Errors)
|
|
36
|
+
* [A/B Testing](https://support.count.ly/hc/en-us/articles/4416496362393-A-B-Testing-)
|
|
37
|
+
* [Performance Monitoring](https://support.count.ly/hc/en-us/articles/4734457847705-Performance)
|
|
38
|
+
* [Feedback Widgets](https://support.count.ly/hc/en-us/articles/4652903481753-Feedback-Surveys-NPS-and-Ratings-)
|
|
38
39
|
|
|
39
40
|
## Security
|
|
40
41
|
Security is very important to us. If you discover any issue regarding security, please disclose the information responsibly by sending an email to security@count.ly and **not by creating a GitHub issue**.
|
|
41
42
|
|
|
42
|
-
## Other Github resources
|
|
43
|
-
Check Countly Community Edition source code here:
|
|
44
|
-
|
|
45
|
-
* [Countly Server](https://github.com/Countly/countly-server)
|
|
46
|
-
|
|
47
|
-
There are also other Countly SDK repositories below:
|
|
48
|
-
|
|
49
|
-
* [Countly iOS SDK](https://github.com/Countly/countly-sdk-ios)
|
|
50
|
-
* [Countly Android SDK](https://github.com/Countly/countly-sdk-android)
|
|
51
|
-
* [Countly Windows Phone SDK](https://github.com/Countly/countly-sdk-windows-phone)
|
|
52
|
-
* [Countly Appcelerator Titanium SDK](https://github.com/euforic/Titanium-Count.ly) (Community supported)
|
|
53
|
-
* [Countly Unity3D SDK](https://github.com/Countly/countly-sdk-unity) (Community supported)
|
|
54
|
-
|
|
55
|
-
## How can I help you with your efforts?
|
|
56
|
-
Glad you asked. We need ideas, feedbacks and constructive comments. All your suggestions will be taken care with upmost importance. We are on [Twitter](http://twitter.com/gocountly) and [Facebook](https://www.facebook.com/Countly) if you would like to keep up with our fast progress!
|
|
57
|
-
|
|
58
43
|
## Badges
|
|
59
|
-
If you like Countly, [why not use one of our badges](https://count.ly/brand-assets) and give a link back to us
|
|
44
|
+
If you like Countly, [why not use one of our badges](https://count.ly/brand-assets) and give a link back to us so others know about this wonderful platform?
|
|
60
45
|
|
|
61
46
|
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/dark.svg?v2" alt="Countly - Product Analytics" /></a>
|
|
62
47
|
|
|
63
|
-
|
|
48
|
+
```JS
|
|
49
|
+
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/dark.svg" alt="Countly - Product Analytics" /></a>
|
|
50
|
+
```
|
|
64
51
|
|
|
65
52
|
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/light.svg?v2" alt="Countly - Product Analytics" /></a>
|
|
66
53
|
|
|
67
|
-
|
|
54
|
+
```JS
|
|
55
|
+
<a href="https://count.ly/f/badge" rel="nofollow"><img style="width:145px;height:60px" src="https://count.ly/badges/light.svg" alt="Countly - Product Analytics" /></a>
|
|
56
|
+
```
|
|
68
57
|
|
|
69
|
-
##
|
|
70
|
-
For
|
|
58
|
+
## How can I help you with your efforts?
|
|
59
|
+
Glad you asked! We need ideas, feedback and constructive comments. All your suggestions will be taken care of with utmost importance. For feature requests and engaging with the community, join [our Slack Community](https://slack.count.ly) or [Community Forum](https://support.count.ly/hc/en-us/community/topics).
|
|
71
60
|
|
|
72
|
-
[
|
|
61
|
+
We are on [Twitter](http://twitter.com/gocountly), [Facebook](https://www.facebook.com/Countly) and [LinkedIn](https://www.linkedin.com/company/countly) if you would like to keep up with Countly related updates.
|
|
Binary file
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable require-jsdoc */
|
|
2
|
+
var Countly = require("../../lib/countly");
|
|
3
|
+
var hp = require("../support/helper");
|
|
4
|
+
|
|
5
|
+
function initMain() {
|
|
6
|
+
Countly.init({
|
|
7
|
+
app_key: "YOUR_APP_KEY",
|
|
8
|
+
url: "https://try.count.ly",
|
|
9
|
+
test_mode: true
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function cause_error() {
|
|
14
|
+
// eslint-disable-next-line no-undef
|
|
15
|
+
undefined_function();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
describe("Crashes tests ", () => {
|
|
19
|
+
it("Checks if a caught crash is reported correctly", () => {
|
|
20
|
+
hp.haltAndClearStorage(() => {
|
|
21
|
+
initMain();
|
|
22
|
+
Countly.track_errors();
|
|
23
|
+
try {
|
|
24
|
+
cause_error();
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
Countly.log_error(err);
|
|
28
|
+
}
|
|
29
|
+
cy.wait(3000).then(() => {
|
|
30
|
+
cy.fetch_local_request_queue().then((rq) => {
|
|
31
|
+
cy.check_crash(rq[0], hp.appKey);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -33,6 +33,32 @@ Cypress.Commands.add("check_request_commons", (testObject, appKey) => {
|
|
|
33
33
|
expect(testObject.sdk_version).to.be.ok;
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Checks a crash request for valid/correct formation
|
|
38
|
+
* @param {Object} testObject - crash object to be checked
|
|
39
|
+
*/
|
|
40
|
+
Cypress.Commands.add("check_crash", (testObject, appKey) => {
|
|
41
|
+
appKey = appKey || hp.appKey;
|
|
42
|
+
const metrics = JSON.parse(testObject.metrics);
|
|
43
|
+
const crash = JSON.parse(testObject.crash);
|
|
44
|
+
const metricKeys = Object.keys(metrics);
|
|
45
|
+
cy.check_request_commons(testObject, appKey);
|
|
46
|
+
cy.check_commons(testObject);
|
|
47
|
+
expect(metrics._ua).to.be.exist;
|
|
48
|
+
expect(metricKeys.length).to.equal(1);
|
|
49
|
+
expect(crash._app_version).to.be.exist;
|
|
50
|
+
expect(crash._background).to.be.exist;
|
|
51
|
+
expect(crash._error).to.be.exist;
|
|
52
|
+
expect(crash._javascript).to.be.exist;
|
|
53
|
+
expect(crash._nonfatal).to.be.exist;
|
|
54
|
+
expect(crash._not_os_specific).to.be.exist;
|
|
55
|
+
expect(crash._online).to.be.exist;
|
|
56
|
+
expect(crash._opengl).to.be.exist;
|
|
57
|
+
expect(crash._resolution).to.be.exist;
|
|
58
|
+
expect(crash._run).to.be.exist;
|
|
59
|
+
expect(crash._view).to.be.exist;
|
|
60
|
+
});
|
|
61
|
+
|
|
36
62
|
/**
|
|
37
63
|
* Checks a queue object for valid/correct begin session, end session and session extension values
|
|
38
64
|
* @param {Object} queue - queue object to check
|
package/lib/countly.js
CHANGED
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
*/
|
|
176
176
|
Countly.onload = Countly.onload || [];
|
|
177
177
|
|
|
178
|
-
var SDK_VERSION = "22.06.
|
|
178
|
+
var SDK_VERSION = "22.06.4";
|
|
179
179
|
var SDK_NAME = "javascript_native_web";
|
|
180
180
|
|
|
181
181
|
var urlParseRE = /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;
|
|
@@ -1624,17 +1624,48 @@
|
|
|
1624
1624
|
* @param {function=} callback - Callback to notify with first param error and second param remote config object
|
|
1625
1625
|
* */
|
|
1626
1626
|
this.fetch_remote_config = function(keys, omit_keys, callback) {
|
|
1627
|
+
var keysFiltered = null;
|
|
1628
|
+
var omitKeysFiltered = null;
|
|
1629
|
+
var callbackFiltered = null;
|
|
1630
|
+
|
|
1631
|
+
// check first param is truthy
|
|
1632
|
+
if (keys) {
|
|
1633
|
+
// if third parameter is falsy and first param is a function assign it as the callback function
|
|
1634
|
+
if (!callback && typeof keys === "function") {
|
|
1635
|
+
callbackFiltered = keys;
|
|
1636
|
+
}
|
|
1637
|
+
// else if first param is an array assign it as 'keys'
|
|
1638
|
+
else if (Array.isArray(keys)) {
|
|
1639
|
+
keysFiltered = keys;
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
// check second param is truthy
|
|
1643
|
+
if (omit_keys) {
|
|
1644
|
+
// if third parameter is falsy and second param is a function assign it as the callback function
|
|
1645
|
+
if (!callback && typeof omit_keys === "function") {
|
|
1646
|
+
callbackFiltered = omit_keys;
|
|
1647
|
+
}
|
|
1648
|
+
// else if second param is an array assign it as 'omit_keys'
|
|
1649
|
+
else if (Array.isArray(omit_keys)) {
|
|
1650
|
+
omitKeysFiltered = omit_keys;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
// assign third param as a callback function if it was not assigned yet in first two params
|
|
1654
|
+
if (!callbackFiltered && typeof callback === "function") {
|
|
1655
|
+
callbackFiltered = callback;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1627
1658
|
// use new RC API
|
|
1628
1659
|
if (this.useExplicitRcApi) {
|
|
1629
1660
|
log(logLevelEnums.INFO, "fetch_remote_config, Fetching remote config");
|
|
1630
1661
|
// opt in is true(1) or false(0)
|
|
1631
1662
|
var opt = this.rcAutoOptinAb ? 1 : 0;
|
|
1632
|
-
fetch_remote_config_explicit(
|
|
1663
|
+
fetch_remote_config_explicit(keysFiltered, omitKeysFiltered, opt, null, callbackFiltered);
|
|
1633
1664
|
return;
|
|
1634
1665
|
}
|
|
1635
1666
|
|
|
1636
1667
|
log(logLevelEnums.WARNING, "fetch_remote_config, Fetching remote config, with legacy API");
|
|
1637
|
-
fetch_remote_config_explicit(
|
|
1668
|
+
fetch_remote_config_explicit(keysFiltered, omitKeysFiltered, null, "legacy", callbackFiltered);
|
|
1638
1669
|
};
|
|
1639
1670
|
|
|
1640
1671
|
/**
|
|
@@ -1651,31 +1682,28 @@
|
|
|
1651
1682
|
method: "rc"
|
|
1652
1683
|
};
|
|
1653
1684
|
// check if keys were provided
|
|
1654
|
-
if (
|
|
1655
|
-
request.keys = JSON.stringify(
|
|
1685
|
+
if (keys) {
|
|
1686
|
+
request.keys = JSON.stringify(keys);
|
|
1656
1687
|
}
|
|
1657
1688
|
// check if omit_keys were provided
|
|
1658
|
-
if (
|
|
1659
|
-
request.omit_keys = JSON.stringify(
|
|
1689
|
+
if (omit_keys) {
|
|
1690
|
+
request.omit_keys = JSON.stringify(omit_keys);
|
|
1660
1691
|
}
|
|
1661
|
-
var
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
if (typeof arguments[j] === "function") {
|
|
1677
|
-
provivedCall = arguments[j];
|
|
1678
|
-
}
|
|
1692
|
+
var providedCall;
|
|
1693
|
+
// legacy api prompt check
|
|
1694
|
+
if (api === "legacy") {
|
|
1695
|
+
request.method = "fetch_remote_config";
|
|
1696
|
+
}
|
|
1697
|
+
// opted out/in check
|
|
1698
|
+
if (optIn === 0) {
|
|
1699
|
+
request.oi = 0;
|
|
1700
|
+
}
|
|
1701
|
+
if (optIn === 1) {
|
|
1702
|
+
request.oi = 1;
|
|
1703
|
+
}
|
|
1704
|
+
// callback check
|
|
1705
|
+
if (typeof callback === "function") {
|
|
1706
|
+
providedCall = callback;
|
|
1679
1707
|
}
|
|
1680
1708
|
if (self.check_consent(featureEnums.SESSIONS)) {
|
|
1681
1709
|
request.metrics = JSON.stringify(getMetrics());
|
|
@@ -1704,17 +1732,17 @@
|
|
|
1704
1732
|
catch (ex) {
|
|
1705
1733
|
log(logLevelEnums.ERROR, "fetch_remote_config_explicit, Had an issue while parsing the response: " + ex);
|
|
1706
1734
|
}
|
|
1707
|
-
if (
|
|
1735
|
+
if (providedCall) {
|
|
1708
1736
|
log(logLevelEnums.INFO, "fetch_remote_config_explicit, Callback function is provided");
|
|
1709
|
-
|
|
1737
|
+
providedCall(err, remoteConfigs);
|
|
1710
1738
|
}
|
|
1711
1739
|
// JSON array can pass
|
|
1712
1740
|
}, true);
|
|
1713
1741
|
}
|
|
1714
1742
|
else {
|
|
1715
1743
|
log(logLevelEnums.ERROR, "fetch_remote_config_explicit, Remote config requires explicit consent");
|
|
1716
|
-
if (
|
|
1717
|
-
|
|
1744
|
+
if (providedCall) {
|
|
1745
|
+
providedCall(new Error("Remote config requires explicit consent"), remoteConfigs);
|
|
1718
1746
|
}
|
|
1719
1747
|
}
|
|
1720
1748
|
}
|
|
@@ -3324,7 +3352,12 @@
|
|
|
3324
3352
|
log(logLevelEnums.ERROR, "Could not get the experimental-webgl context: " + ex);
|
|
3325
3353
|
}
|
|
3326
3354
|
|
|
3327
|
-
|
|
3355
|
+
// send userAgent string with the crash object incase it gets removed by a gateway
|
|
3356
|
+
var req = {};
|
|
3357
|
+
req.crash = JSON.stringify(obj);
|
|
3358
|
+
req.metrics = JSON.stringify({ _ua: metrics._ua });
|
|
3359
|
+
|
|
3360
|
+
toRequestQueue(req);
|
|
3328
3361
|
}
|
|
3329
3362
|
};
|
|
3330
3363
|
|
package/lib/countly.min.js
CHANGED
|
@@ -1,137 +1,136 @@
|
|
|
1
|
-
(function(n,
|
|
2
|
-
function(p){var u=(h+16*Math.random())%16|0;h=Math.floor(h/16);return("x"===p?u:u&3|8).toString(16)})}function B(){return Math.floor((new Date).getTime()/1E3)}function
|
|
3
|
-
"="+encodeURIComponent(h[u]));return p.join("&")}function
|
|
4
|
-
"string"===typeof h&&h.length>p&&(
|
|
1
|
+
(function(n,ja){"function"===typeof define&&define.amd?define([],function(){return ja(n.Countly)}):"object"===typeof module&&module.exports?module.exports=ja(n.Countly):n.Countly=ja(n.Countly)})("undefined"!==typeof window?window:this,function(n){function ja(h){var p=[];if("undefined"!==typeof h.options)for(var u=0;u<h.options.length;u++)h.options[u].selected&&p.push(h.options[u].value);return p.join(", ")}function ab(){var h=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,
|
|
2
|
+
function(p){var u=(h+16*Math.random())%16|0;h=Math.floor(h/16);return("x"===p?u:u&3|8).toString(16)})}function B(){return Math.floor((new Date).getTime()/1E3)}function Qa(){var h=(new Date).getTime();Aa>=h?Aa++:Aa=h;return Aa}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 Ra(h,p,u){for(var C in n.i)n.i[C].tracking_crashes&&n.i[C].recordError(h,p,u)}function bb(h){var p=[],u;for(u in h)p.push(u+
|
|
3
|
+
"="+encodeURIComponent(h[u]));return p.join("&")}function ka(h){return"string"===typeof h&&"/"===h.substring(h.length-1)?h.substring(0,h.length-1):h}function oa(h,p){for(var u={},C,J=0,O=p.length;J<O;J++)C=p[J],"undefined"!==typeof h[C]&&(u[C]=h[C]);return u}function U(h,p,u,C,J,O){var Y={};if(h){if(Object.keys(h).length>C){var Z={},pa=0,ba;for(ba in h)pa<C&&(Z[ba]=h[ba],pa++);h=Z}for(var F in h)C=w(F,p,J,O),Z=w(h[F],u,J,O),Y[C]=Z}return Y}function w(h,p,u,C){var J=h;"number"===typeof h&&(h=h.toString());
|
|
4
|
+
"string"===typeof h&&h.length>p&&(J=h.substring(0,p),C(d.DEBUG,u+", Key: [ "+h+" ] is longer than accepted length. It will be truncated."));return J}function qa(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 cb(h){if(!h){if(navigator.userAgentData.mobile)return"phone";h=qa()}h=h.toLowerCase();
|
|
5
5
|
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 db(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||
|
|
6
|
-
qa())}function
|
|
7
|
-
function
|
|
8
|
-
|
|
6
|
+
qa())}function Sa(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 Ba(){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))}
|
|
7
|
+
function Ta(){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 eb(){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 fb(h,p,u,C,J,O){h=document.createElement(h);var Y;h.setAttribute(p,u);h.setAttribute(C,
|
|
8
|
+
J);p=function(){Y||O();Y=!0};O&&(h.onreadystatechange=p,h.onload=p);document.getElementsByTagName("head")[0].appendChild(h)}function gb(h,p){fb("script","type","text/javascript","src",h,p)}function Ca(h,p){fb("link","rel","stylesheet","href",h,p)}function hb(){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%;}}":
|
|
9
9
|
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%;}}"));
|
|
10
10
|
p.appendChild(u);h=document.createElement("div");h.setAttribute("id","cly-loader");document.body.onload=function(){if(!n.showLoaderProtection)try{document.body.appendChild(h)}catch(C){}}}h.style.display="block"}function ib(){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(" ");
|
|
11
|
-
var d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "};n.q=n.q||[];n.onload=n.onload||[];var jb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;n.CountlyClass=function(h){function p(a){if(g.ignore_visitor)
|
|
12
|
-
"add_cly_event",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
window.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
y(g.namespace+"
|
|
36
|
-
|
|
37
|
-
h,100),ma=r("max_logs",h,null),ea=r("use_session_cookie",h,!0),va=r("session_cookie_timeout",h,30),La=!0,Ia=!1,H=r("offline_mode",h,!1),W={},da=!0,qb=B(),ha=!0,na=null,D=1,ya=!1,xa=0;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(a){b(d.ERROR,"Local storage test failed, Halting local storage support: "+a),ha=!1}for(var A={},$a=0;$a<n.features.length;$a++)A[n.features[$a]]={};this.initialize=function(){this.serialize=r("serialize",h,n.serialize);this.deserialize=
|
|
11
|
+
var d={ERROR:"[ERROR] ",WARNING:"[WARNING] ",INFO:"[INFO] ",DEBUG:"[DEBUG] ",VERBOSE:"[VERBOSE] "};n.q=n.q||[];n.onload=n.onload||[];var jb=/^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?::([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?::([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/;n.CountlyClass=function(h){function p(a){if(g.ignore_visitor)c(d.ERROR,"Adding event failed. Possible bot or user opt out");else if(a.key){a.count||(a.count=1);a.key=w(a.key,g.maxKeyLength,
|
|
12
|
+
"add_cly_event",c);a.segmentation=U(a.segmentation,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"add_cly_event",c);var b=oa(a,["key","count","sum","dur","segmentation"]);b.timestamp=Qa();var e=new Date;b.hour=e.getHours();b.dow=e.getDay();G.push(b);v("cly_event",G);c(d.INFO,"Successfully adding event: ",a)}else c(d.ERROR,"Adding event failed. Event must have a key property")}function u(a,b,e,k,l){c(d.INFO,"fetch_remote_config_explicit, Fetching sequence initiated");var f={method:"rc"};a&&
|
|
13
|
+
(f.keys=JSON.stringify(a));b&&(f.omit_keys=JSON.stringify(b));var m;"legacy"===k&&(f.method="fetch_remote_config");0===e&&(f.oi=0);1===e&&(f.oi=1);"function"===typeof l&&(m=l);g.check_consent("sessions")&&(f.metrics=JSON.stringify(Da()));g.check_consent("remote-config")?(ba(f),aa("fetch_remote_config_explicit",g.url+Ea,f,function(q,t,H){if(q)c(d.ERROR,"fetch_remote_config_explicit, An error occurred: "+q);else{try{var P=JSON.parse(H);if(f.keys||f.omit_keys)for(var K in P)M[K]=P[K];else M=P;v("cly_remote_configs",
|
|
14
|
+
M)}catch(la){c(d.ERROR,"fetch_remote_config_explicit, Had an issue while parsing the response: "+la)}m&&(c(d.INFO,"fetch_remote_config_explicit, Callback function is provided"),m(q,M))}},!0)):(c(d.ERROR,"fetch_remote_config_explicit, Remote config requires explicit consent"),m&&m(Error("Remote config requires explicit consent"),M))}function C(){g.ignore_prefetch&&"undefined"!==typeof document.visibilityState&&"prerender"===document.visibilityState&&(g.ignore_visitor=!0);g.ignore_bots&&db()&&(g.ignore_visitor=
|
|
15
|
+
!0)}function J(){0<G.length&&(F({events:JSON.stringify(G)}),G=[],v("cly_event",G))}function O(a,b){if(document.getElementById("countly-feedback-sticker-"+a._id))c(d.ERROR,"Widget with same ID exists");else try{var e=document.createElement("div");e.className="countly-iframe-wrapper";e.id="countly-iframe-wrapper-"+a._id;var k=document.createElement("span");k.className="countly-feedback-close-icon";k.id="countly-feedback-close-icon-"+a._id;k.innerText="x";var l=document.createElement("iframe");l.name=
|
|
16
|
+
"countly-feedback-iframe";l.id="countly-feedback-iframe";l.src=g.url+"/feedback?widget_id="+a._id+"&app_key="+g.app_key+"&device_id="+g.device_id+"&sdk_version=22.06.4";document.body.appendChild(e);e.appendChild(k);e.appendChild(l);x(document.getElementById("countly-feedback-close-icon-"+a._id),"click",function(){document.getElementById("countly-iframe-wrapper-"+a._id).style.display="none";document.getElementById("cfbg").style.display="none"});if(b){var f=document.createElementNS("http://www.w3.org/2000/svg",
|
|
17
|
+
"svg");f.id="feedback-sticker-svg";f.setAttribute("aria-hidden","true");f.setAttribute("data-prefix","far");f.setAttribute("data-icon","grin");f.setAttribute("class","svg-inline--fa fa-grin fa-w-16");f.setAttribute("role","img");f.setAttribute("xmlns","http://www.w3.org/2000/svg");f.setAttribute("viewBox","0 0 496 512");var m=document.createElementNS("http://www.w3.org/2000/svg","path");m.id="smileyPathInStickerSvg";m.setAttribute("fill","white");m.setAttribute("d","M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 448c-110.3 0-200-89.7-200-200S137.7 56 248 56s200 89.7 200 200-89.7 200-200 200zm105.6-151.4c-25.9 8.3-64.4 13.1-105.6 13.1s-79.6-4.8-105.6-13.1c-9.9-3.1-19.4 5.4-17.7 15.3 7.9 47.1 71.3 80 123.3 80s115.3-32.9 123.3-80c1.6-9.8-7.7-18.4-17.7-15.3zM168 240c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z");
|
|
18
|
+
var q=document.createElement("span");q.innerText=a.trigger_button_text;var t=document.createElement("div");t.style.color=7>a.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;f.appendChild(m);t.appendChild(f);t.appendChild(q);document.body.appendChild(t);var H=document.getElementById("smileyPathInStickerSvg");
|
|
19
|
+
H&&(H.style.fill=7>a.trigger_font_color.length?"#"+a.trigger_font_color:a.trigger_font_color);x(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(P){c(d.ERROR,"Somethings went wrong while element injecting process: "+
|
|
20
|
+
P)}}function Y(){var a;if("undefined"!==typeof g.onload&&0<g.onload.length){for(a=0;a<g.onload.length;a++)if("function"===typeof g.onload[a])g.onload[a](g);g.onload=[]}}function Z(){if(Q){var a={name:Q};g.check_consent("views")&&p({key:"[CLY]_view",dur:ca?B()-ra:sa,segmentation:a});Q=null}}function pa(){if(da){var a=y("cly_session");if(!a||parseInt(a)<=B())V=!1,g.begin_session(!ta);v("cly_session",B()+60*ua)}}function ba(a){a.app_key=g.app_key;a.device_id=g.device_id;a.sdk_name="javascript_native_web";
|
|
21
|
+
a.sdk_version="22.06.4";a.t=D;g.check_consent("location")?(g.country_code&&(a.country_code=g.country_code),g.city&&(a.city=g.city),null!==g.ip_address&&(a.ip_address=g.ip_address)):a.location="";a.timestamp=Qa();var b=new Date;a.hour=b.getHours();a.dow=b.getDay()}function F(a){g.ignore_visitor?c(d.WARNING,"User is opt_out will ignore the request: "+a):g.app_key&&g.device_id?(ba(a),E.length>Fa&&E.shift(),E.push(a),v("cly_queue",E,!0)):c(d.ERROR,"app_key or device_id is missing ",g.app_key,g.device_id)}
|
|
22
|
+
function Ga(){Y();if(g.ignore_visitor)Ha=!1,c(d.WARNING,"User opt_out, no heartbeat");else{Ha=!0;var a=0;if(Ia&&"undefined"!==typeof n.q&&0<n.q.length){var b=n.q;n.q=[];for(a=0;a<b.length;a++){var e=b[a];c(d.DEBUG,"Processing queued call",e);if("function"===typeof e)e();else if(Array.isArray(e)&&0<e.length){var k=g,l=0;n.i[e[l]]&&(k=n.i[e[l]],l++);if("function"===typeof k[e[l]])k[e[l]].apply(k,e.slice(l+1));else if(0===e[l].indexOf("userData.")){var f=e[l].replace("userData.","");"function"===typeof k.userData[f]&&
|
|
23
|
+
k.userData[f].apply(k,e.slice(l+1))}else"function"===typeof n[e[l]]&&n[e[l]].apply(n,e.slice(l+1))}}}V&&ta&&ca&&(a=B(),a-ea>Ja&&(g.session_duration(a-ea),ea=a));0<G.length&&(G.length<=va?(F({events:JSON.stringify(G)}),G=[]):(a=G.splice(0,va),F({events:JSON.stringify(a)})),v("cly_event",G));!I&&0<E.length&&Ka&&B()>Ua&&(Ka=!1,a=E[0],c(d.DEBUG,"Processing request",a),v("cly_queue",E,!0),g.test_mode||aa("send_request_queue",g.url+kb,a,function(m,q){c(d.DEBUG,"Request Finished",q,m);m?(Ua=B()+La,c(d.ERROR,
|
|
24
|
+
"Request error: ",m)):E.shift();v("cly_queue",E,!0);Ka=!0},!1));setTimeout(Ga,Ma)}}function Va(){var a=y("cly_id");return a?(D=y("cly_id_type"),a):ab()}function Da(){var a=JSON.parse(JSON.stringify(g.metrics||{}));a._app_version=a._app_version||g.app_version;a._ua=a._ua||qa();if(screen.width){var b=screen.width?parseInt(screen.width):0,e=screen.height?parseInt(screen.height):0;if(0!==b&&0!==e){if(navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)&&window.devicePixelRatio)b=Math.round(b*
|
|
25
|
+
window.devicePixelRatio),e=Math.round(e*window.devicePixelRatio);else if(90===Math.abs(window.orientation)){var k=b;b=e;e=k}a._resolution=a._resolution||""+b+"x"+e}}window.devicePixelRatio&&(a._density=a._density||window.devicePixelRatio);b=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;"undefined"!==typeof b&&(a._locale=a._locale||b);if("undefined"!==typeof document.referrer&&document.referrer.length&&(b=jb.exec(document.referrer))&&b[11]&&b[11]!==
|
|
26
|
+
window.location.hostname){b=!1;if(R&&R.length)for(e=0;e<R.length;e++)try{if((new RegExp(R[e])).test(document.referrer)){c(d.DEBUG,"Ignored: "+document.referrer);b=!0;break}}catch(l){c(d.ERROR,"Problem with ignoring: "+R[e],", error: "+l)}b||(a._store=a._store||document.referrer)}c(d.DEBUG,"Got metrics",a);return a}function c(a,b){if(g.debug&&"undefined"!==typeof console){arguments[2]&&"object"===typeof arguments[2]&&(arguments[2]=JSON.stringify(arguments[2]));Ia||(b="["+g.app_key+"] "+b);a||(a=d.DEBUG);
|
|
27
|
+
for(var e="",k=2;k<arguments.length;k++)e+=arguments[k];e=a+b+e;a===d.ERROR?console.error(e):a===d.WARNING?console.warn(e):a===d.INFO?console.info(e):a===d.VERBOSE?console.log(e):console.debug(e)}}function aa(a,b,e,k,l){l=l||!1;try{c(d.DEBUG,"Sending XML HTTP request");var f=null;window.XMLHttpRequest?f=new window.XMLHttpRequest:window.ActiveXObject&&(f=new window.ActiveXObject("Microsoft.XMLHTTP"));e=e||{};var m=bb(e),q="GET";if(g.force_post||2E3<=m.length)q="POST";"GET"===q?f.open("GET",b+"?"+m,
|
|
28
|
+
!0):(f.open("POST",b,!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"));for(var t in g.headers)f.setRequestHeader(t,g.headers[t]);f.onreadystatechange=function(){4===this.readyState&&(c(d.DEBUG,a+" HTTP request completed ["+this.status+"]["+this.responseText+"]"),(l?lb(this.status,this.responseText):mb(this.status,this.responseText))?"function"===typeof k&&k(!1,e,this.responseText):(c(d.ERROR,a+" Failed Server XML HTTP request, ",this.status),"function"===typeof k&&k(!0,e)))};
|
|
29
|
+
"GET"===q?f.send():f.send(m)}catch(H){c(d.ERROR,a+" Failed XML HTTP request: "+H),"function"===typeof k&&k(!0,e)}}function mb(a,b){if(!(200<=a&&300>a))return c(d.ERROR,"Http response status code is not within the expected range:["+a+"]"),!1;try{var e=JSON.parse(b);return"[object Object]"!==Object.prototype.toString.call(e)?(c(d.ERROR,"Http response is not JSON Object"),!1):!!e.result}catch(k){return c(d.ERROR,"Http response is not JSON: "+k),!1}}function lb(a,b){if(!(200<=a&&300>a))return c(d.ERROR,
|
|
30
|
+
"Http response status code is not within the expected range: "+a),!1;try{var e=JSON.parse(b);return"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)?!0:(c(d.ERROR,"Http response is not JSON Object nor JSON Array"),!1)}catch(k){return c(d.ERROR,"Http response is not JSON: "+k),!1}}function nb(){wa=Math.max(wa,window.scrollY,document.body.scrollTop,document.documentElement.scrollTop)}function Wa(){if(xa){xa=!1;var a=Ba(),b=Ta(),e=eb();g.check_consent("scrolls")&&(a={type:"scroll",
|
|
31
|
+
y:wa+e,width:b,height:a,view:g.getViewUrl()},a=U(a,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"processScrollView",c),g.track_domains&&(a.domain=window.location.hostname),p({key:"[CLY]_action",segmentation:a}))}}function ob(a){v("cly_token",a)}function pb(a,b,e){var k=new Date;k.setTime(k.getTime()+864E5*e);e="; expires="+k.toGMTString();document.cookie=a+"="+b+e+"; path=/"}function y(a,b,e){if("none"===g.storage)c(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be retrieved");
|
|
32
|
+
else{e||(a=g.app_key+"/"+a,g.namespace&&(a=ka(g.namespace)+"/"+a));void 0===b&&(b=fa);if(b)var k=localStorage.getItem(a);else if("localstorage"!==g.storage)a:{a+="=";b=document.cookie.split(";");e=0;for(k=b.length;e<k;e++){for(var l=b[e];" "===l.charAt(0);)l=l.substring(1,l.length);if(0===l.indexOf(a)){k=l.substring(a.length,l.length);break a}}k=null}return g.deserialize(k)}}function v(a,b,e,k){"none"===g.storage?c(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be stored"):(k||(a=g.app_key+
|
|
33
|
+
"/"+a,g.namespace&&(a=ka(g.namespace)+"/"+a)),void 0===e&&(e=fa),"undefined"!==typeof b&&null!==b&&(b=g.serialize(b),e?localStorage.setItem(a,b):"localstorage"!==g.storage&&pb(a,b,30)))}function S(a,b,e){"none"===g.storage?c(d.WARNING,"Storage is disabled. Value with key: "+a+" won't be removed"):(e||(a=g.app_key+"/"+a,g.namespace&&(a=ka(g.namespace)+"/"+a)),void 0===b&&(b=fa),b?localStorage.removeItem(a):"localstorage"!==g.storage&&pb(a,"",-1))}function sb(){if(y(g.namespace+"cly_id",!1,!0)){v("cly_id",
|
|
34
|
+
y(g.namespace+"cly_id",!1,!0));v("cly_id_type",y(g.namespace+"cly_id_type",!1,!0));v("cly_event",y(g.namespace+"cly_event",!1,!0));v("cly_session",y(g.namespace+"cly_session",!1,!0));var a=y(g.namespace+"cly_queue",!1,!0);Array.isArray(a)&&(a=a.filter(function(b){return b.app_key===g.app_key}),v("cly_queue",a));y(g.namespace+"cly_cmp_id",!1,!0)&&(v("cly_cmp_id",y(g.namespace+"cly_cmp_id",!1,!0)),v("cly_cmp_uid",y(g.namespace+"cly_cmp_uid",!1,!0)));y(g.namespace+"cly_ignore",!1,!0)&&v("cly_ignore",
|
|
35
|
+
y(g.namespace+"cly_ignore",!1,!0));S("cly_id",!1,!0);S("cly_id_type",!1,!0);S("cly_event",!1,!0);S("cly_session",!1,!0);S("cly_queue",!1,!0);S("cly_cmp_id",!1,!0);S("cly_cmp_uid",!1,!0);S("cly_ignore",!1,!0)}}var g=this,Ia=!n.i,V=!1,kb="/i",Ea="/o/sdk",Ma=r("interval",h,500),Fa=r("queue_size",h,1E3),E=[],G=[],M={},ha=[],ia={},R=r("ignore_referrers",h,[]),Xa=null,ta=!0,ea,Ya=0,Q=null,ra=0,sa=0,Ua=0,La=r("fail_timeout",h,60),ya=r("inactivity_time",h,20),za=0,Ja=r("session_update",h,60),va=r("max_events",
|
|
36
|
+
h,100),ma=r("max_logs",h,null),da=r("use_session_cookie",h,!0),ua=r("session_cookie_timeout",h,30),Ka=!0,Ha=!1,I=r("offline_mode",h,!1),W={},ca=!0,qb=B(),fa=!0,na=null,D=1,xa=!1,wa=0;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(a){c(d.ERROR,"Local storage test failed, Halting local storage support: "+a),fa=!1}for(var A={},Za=0;Za<n.features.length;Za++)A[n.features[Za]]={};this.initialize=function(){this.serialize=r("serialize",h,n.serialize);this.deserialize=
|
|
38
37
|
r("deserialize",h,n.deserialize);this.getViewName=r("getViewName",h,n.getViewName);this.getViewUrl=r("getViewUrl",h,n.getViewUrl);this.getSearchQuery=r("getSearchQuery",h,n.getSearchQuery);this.DeviceIdType=n.DeviceIdType;this.namespace=r("namespace",h,"");this.clearStoredId=r("clear_stored_id",h,!1);this.app_key=r("app_key",h,null);this.onload=r("onload",h,[]);this.utm=r("utm",h,{source:!0,medium:!0,campaign:!0,term:!0,content:!0});this.ignore_prefetch=r("ignore_prefetch",h,!0);this.rcAutoOptinAb=
|
|
39
|
-
r("rc_automatic_optin_for_ab",h,!0);this.useExplicitRcApi=r("use_explicit_rc_api",h,!1);this.debug=r("debug",h,!1);this.test_mode=r("test_mode",h,!1);this.metrics=r("metrics",h,{});this.headers=r("headers",h,{});this.url=
|
|
38
|
+
r("rc_automatic_optin_for_ab",h,!0);this.useExplicitRcApi=r("use_explicit_rc_api",h,!1);this.debug=r("debug",h,!1);this.test_mode=r("test_mode",h,!1);this.metrics=r("metrics",h,{});this.headers=r("headers",h,{});this.url=ka(r("url",h,""));this.app_version=r("app_version",h,"0.0");this.country_code=r("country_code",h,null);this.city=r("city",h,null);this.ip_address=r("ip_address",h,null);this.ignore_bots=r("ignore_bots",h,!0);this.force_post=r("force_post",h,!1);this.remote_config=r("remote_config",
|
|
40
39
|
h,!1);this.ignore_visitor=r("ignore_visitor",h,!1);this.require_consent=r("require_consent",h,!1);this.track_domains=r("track_domains",h,!0);this.storage=r("storage",h,"default");this.enableOrientationTracking=r("enable_orientation_tracking",h,!0);this.maxKeyLength=r("max_key_length",h,128);this.maxValueSize=r("max_value_size",h,256);this.maxSegmentationValues=r("max_segmentation_values",h,30);this.maxBreadcrumbCount=r("max_breadcrumb_count",h,null);this.maxStackTraceLinesPerThread=r("max_stack_trace_lines_per_thread",
|
|
41
|
-
h,30);this.maxStackTraceLineLength=r("max_stack_trace_line_length",h,200);this.heatmapWhitelist=r("heatmap_whitelist",h,[]);ma&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ma,
|
|
42
|
-
!0);Array.isArray(
|
|
43
|
-
""))}catch(q){
|
|
44
|
-
y("cly_old_token")&&(ob(this.passed_data.token),v("cly_old_token",this.passed_data.token));var a=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),a=this.heatmapWhitelist.map(function(q){return
|
|
45
|
-
else{
|
|
46
|
-
"]"),
|
|
47
|
-
this.clearStoredId+"]");this.ignore_prefetch&&
|
|
48
|
-
"]");this.ignore_bots&&
|
|
49
|
-
this.track_domains&&
|
|
50
|
-
!!this.getViewName+"]");
|
|
51
|
-
"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries");30!==this.maxStackTraceLinesPerThread&&
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.utm[f[0].replace("utm_","")]&&(k[f[0].replace("utm_","")]=f[1],e=!0)}}
|
|
55
|
-
l,h&&Object.keys(h).length?void 0!==h.device_id&&(D=0):void 0!==n.device_id&&(D=0)):
|
|
56
|
-
(D=0));v("cly_id",this.device_id);v("cly_id_type",D);if(e){for(var m in this.utm)k[m]?this.userData.set("utm_"+m,k[m]):this.userData.unset("utm_"+m);this.userData.save()}Y();setTimeout(function(){
|
|
57
|
-
|
|
40
|
+
h,30);this.maxStackTraceLineLength=r("max_stack_trace_line_length",h,200);this.heatmapWhitelist=r("heatmap_whitelist",h,[]);ma&&!this.maxBreadcrumbCount?(this.maxBreadcrumbCount=ma,c(d.WARNING,"initialize, 'maxCrashLogs' is deprecated. Use 'maxBreadcrumbCount' instead!")):ma||this.maxBreadcrumbCount||(this.maxBreadcrumbCount=100);"cookie"===this.storage&&(fa=!1);this.rcAutoOptinAb||this.useExplicitRcApi||(c(d.WARNING,"initialize, Auto opting is disabled, switching to explicit RC API"),this.useExplicitRcApi=
|
|
41
|
+
!0);Array.isArray(R)||(R=[]);""===this.url&&(c(d.ERROR,"initialize, Please provide server URL"),this.ignore_visitor=!0);y("cly_ignore")&&(this.ignore_visitor=!0);sb();this.clearStoredId&&(c(d.INFO,"initialize, Clearing the device ID storage"),localStorage.removeItem(this.app_key+"/cly_id"),localStorage.removeItem(this.app_key+"/cly_id_type"));E=y("cly_queue")||[];G=y("cly_event")||[];M=y("cly_remote_configs")||{};C();if(window.name&&0===window.name.indexOf("cly:"))try{this.passed_data=JSON.parse(window.name.replace("cly:",
|
|
42
|
+
""))}catch(q){c(d.ERROR,"initialize, Could not parse name: "+window.name+", error: "+q)}else if(location.hash&&0===location.hash.indexOf("#cly:"))try{this.passed_data=JSON.parse(location.hash.replace("#cly:",""))}catch(q){c(d.ERROR,"initialize, Could not parse hash: "+location.hash+", error: "+q)}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&&Ia)&&this.passed_data.token&&this.passed_data.purpose){this.passed_data.token!==
|
|
43
|
+
y("cly_old_token")&&(ob(this.passed_data.token),v("cly_old_token",this.passed_data.token));var a=[];Array.isArray(this.heatmapWhitelist)?(this.heatmapWhitelist.push(this.url),a=this.heatmapWhitelist.map(function(q){return ka(q)})):a=[this.url];a.includes(this.passed_data.url)&&"heatmap"===this.passed_data.purpose&&(this.ignore_visitor=!0,hb(),gb(this.passed_data.url+"/views/heatmap.js",ib))}if(this.ignore_visitor)c(d.WARNING,"initialize, ignore_visitor:["+this.ignore_visitor+"], this user will not be tracked");
|
|
44
|
+
else{c(d.DEBUG,"initialize, app_key:["+this.app_key+"], url:["+this.url+"]");c(d.DEBUG,"initialize, device_id:["+r("device_id",h,void 0)+"]");c(d.DEBUG,"initialize, require_consent is enabled:["+this.require_consent+"]");try{c(d.DEBUG,"initialize, metric override:["+JSON.stringify(this.metrics)+"]"),c(d.DEBUG,"initialize, header override:["+JSON.stringify(this.headers)+"]"),c(d.DEBUG,"initialize, number of onload callbacks provided:["+this.onload.length+"]"),c(d.DEBUG,"initialize, utm tags:["+JSON.stringify(this.utm)+
|
|
45
|
+
"]"),R&&c(d.DEBUG,"initialize, referrers to ignore :["+JSON.stringify(R)+"]")}catch(q){c(d.ERROR,"initialize, Could not stringify some config object values")}c(d.DEBUG,"initialize, app_version:["+this.app_version+"]");c(d.DEBUG,"initialize, provided location info; country_code:["+this.country_code+"], city:["+this.city+"], ip_address:["+this.ip_address+"]");""!==this.namespace&&c(d.DEBUG,"initialize, namespace given:["+this.namespace+"]");this.clearStoredId&&c(d.DEBUG,"initialize, clearStoredId flag set to:["+
|
|
46
|
+
this.clearStoredId+"]");this.ignore_prefetch&&c(d.DEBUG,"initialize, ignoring pre-fetching and pre-rendering from counting as real website visits :["+this.ignore_prefetch+"]");this.test_mode&&c(d.WARNING,"initialize, test_mode:["+this.test_mode+"], queues won't be processed");this.heatmapWhitelist&&c(d.DEBUG,"initialize, heatmap whitelist:["+JSON.stringify(this.heatmapWhitelist)+"], these domains will be whitelisted");"default"!==this.storage&&c(d.DEBUG,"initialize, storage is set to:["+this.storage+
|
|
47
|
+
"]");this.ignore_bots&&c(d.DEBUG,"initialize, ignore traffic from bots :["+this.ignore_bots+"]");this.force_post&&c(d.DEBUG,"initialize, forced post method for all requests:["+this.force_post+"]");this.remote_config&&c(d.DEBUG,"initialize, remote_config callback provided:["+!!this.remote_config+"]");"boolean"===typeof this.rcAutoOptinAb&&c(d.DEBUG,"initialize, automatic RC optin is enabled:["+this.rcAutoOptinAb+"]");this.useExplicitRcApi||c(d.WARNING,"initialize, will use legacy RC API. Consider enabling new API during init with use_explicit_rc_api flag");
|
|
48
|
+
this.track_domains&&c(d.DEBUG,"initialize, tracking domain info:["+this.track_domains+"]");this.enableOrientationTracking&&c(d.DEBUG,"initialize, enableOrientationTracking:["+this.enableOrientationTracking+"]");da||c(d.WARNING,"initialize, use_session_cookie is enabled:["+da+"]");I&&c(d.DEBUG,"initialize, offline_mode:["+I+"], user info won't be send to the servers");I&&c(d.DEBUG,"initialize, stored remote configs:["+JSON.stringify(M)+"]");c(d.DEBUG,"initialize, 'getViewName' callback override provided:["+
|
|
49
|
+
!!this.getViewName+"]");c(d.DEBUG,"initialize, 'getSearchQuery' callback override provided:["+!!this.getSearchQuery+"]");128!==this.maxKeyLength&&c(d.DEBUG,"initialize, maxKeyLength set to:["+this.maxKeyLength+"] characters");256!==this.maxValueSize&&c(d.DEBUG,"initialize, maxValueSize set to:["+this.maxValueSize+"] characters");30!==this.maxSegmentationValues&&c(d.DEBUG,"initialize, maxSegmentationValues set to:["+this.maxSegmentationValues+"] key/value pairs");100!==this.maxBreadcrumbCount&&c(d.DEBUG,
|
|
50
|
+
"initialize, maxBreadcrumbCount for custom logs set to:["+this.maxBreadcrumbCount+"] entries");30!==this.maxStackTraceLinesPerThread&&c(d.DEBUG,"initialize, maxStackTraceLinesPerThread set to:["+this.maxStackTraceLinesPerThread+"] lines");200!==this.maxStackTraceLineLength&&c(d.DEBUG,"initialize, maxStackTraceLineLength set to:["+this.maxStackTraceLineLength+"] characters");500!==Ma&&c(d.DEBUG,"initialize, interval for heartbeats set to:["+Ma+"] milliseconds");1E3!==Fa&&c(d.DEBUG,"initialize, queue_size set to:["+
|
|
51
|
+
Fa+"] items max");60!==La&&c(d.DEBUG,"initialize, fail_timeout set to:["+La+"] seconds of wait time after a failed connection to server");20!==ya&&c(d.DEBUG,"initialize, inactivity_time set to:["+ya+"] minutes to consider a user as inactive after no observable action");60!==Ja&&c(d.DEBUG,"initialize, session_update set to:["+Ja+"] seconds to check if extending a session is needed while the user is active");100!==va&&c(d.DEBUG,"initialize, max_events set to:["+va+"] events to send in one batch");ma&&
|
|
52
|
+
c(d.WARNING,"initialize, max_logs set to:["+ma+"] breadcrumbs to store for crash logs max, deprecated ");30!==ua&&c(d.DEBUG,"initialize, session_cookie_timeout set to:["+ua+"] minutes to expire a cookies session");c(d.INFO,"initialize, Countly initialized");a=null;var b=g.getSearchQuery(),e=!1,k={};if(b){b=b.substring(1).split("&");for(var l=0;l<b.length;l++){var f=b[l].split("=");"cly_id"===f[0]?v("cly_cmp_id",f[1]):"cly_uid"===f[0]?v("cly_cmp_uid",f[1]):"cly_device_id"===f[0]?a=f[1]:0===(f[0]+"").indexOf("utm_")&&
|
|
53
|
+
this.utm[f[0].replace("utm_","")]&&(k[f[0].replace("utm_","")]=f[1],e=!0)}}b="[CLY]_temp_id"===y("cly_id");l=r("device_id",h,void 0);y("cly_id")&&!b?(this.device_id=y("cly_id"),c(d.INFO,"initialize, Set the stored device ID"),D=y("cly_id_type"),D||(c(d.INFO,"initialize, No device ID type info from the previous session, falling back to DEVELOPER_SUPPLIED"),D=0)):null!==a?(c(d.INFO,"initialize, Device ID set by URL"),this.device_id=a,D=3):l?(c(d.INFO,"initialize, Device ID set by developer"),this.device_id=
|
|
54
|
+
l,h&&Object.keys(h).length?void 0!==h.device_id&&(D=0):void 0!==n.device_id&&(D=0)):I||b?(this.device_id="[CLY]_temp_id",D=2,I&&b?c(d.INFO,"initialize, Temp ID set, continuing offline mode from previous app session"):I&&!b?c(d.INFO,"initialize, Temp ID set, entering offline mode"):(I=!0,c(d.INFO,"initialize, Temp ID set, enabling offline mode"))):(c(d.INFO,"initialize, Generating the device ID"),this.device_id=r("device_id",h,Va()),h&&Object.keys(h).length?void 0!==h.device_id&&(D=0):void 0!==n.device_id&&
|
|
55
|
+
(D=0));v("cly_id",this.device_id);v("cly_id_type",D);if(e){for(var m in this.utm)k[m]?this.userData.set("utm_"+m,k[m]):this.userData.unset("utm_"+m);this.userData.save()}Y();setTimeout(function(){Ga();g.remote_config&&g.fetch_remote_config(g.remote_config)},1);document.documentElement.setAttribute("data-countly-useragent",qa())}};this.halt=function(){c(d.WARNING,"halt, Resetting Countly");n.i=void 0;Ia=!n.i;V=!1;kb="/i";Ea="/o/sdk";Ma=500;Fa=1E3;E=[];G=[];M={};ha=[];ia={};R=[];Xa=null;ta=!0;Ya=0;
|
|
56
|
+
Q=null;Ua=sa=ra=0;La=60;ya=20;za=0;Ja=60;va=100;ma=null;da=!0;ua=30;Ka=!0;I=Ha=!1;W={};ca=!0;qb=B();fa=!0;na=null;D=1;xa=!1;wa=0;try{localStorage.setItem("cly_testLocal",!0),localStorage.removeItem("cly_testLocal")}catch(b){c(d.ERROR,"halt, Local storage test failed, will fallback to cookies"),fa=!1}n.features="sessions events views scrolls clicks forms crashes attribution users star-rating location apm feedback remote-config".split(" ");A={};for(var a=0;a<n.features.length;a++)A[n.features[a]]={};
|
|
58
57
|
g.app_key=void 0;g.device_id=void 0;g.onload=void 0;g.utm=void 0;g.ignore_prefetch=void 0;g.debug=void 0;g.test_mode=void 0;g.metrics=void 0;g.headers=void 0;g.url=void 0;g.app_version=void 0;g.country_code=void 0;g.city=void 0;g.ip_address=void 0;g.ignore_bots=void 0;g.force_post=void 0;g.rcAutoOptinAb=void 0;g.useExplicitRcApi=void 0;g.remote_config=void 0;g.ignore_visitor=void 0;g.require_consent=void 0;g.track_domains=void 0;g.storage=void 0;g.enableOrientationTracking=void 0;g.maxKeyLength=void 0;
|
|
59
|
-
g.maxValueSize=void 0;g.maxSegmentationValues=void 0;g.maxBreadcrumbCount=void 0;g.maxStackTraceLinesPerThread=void 0;g.maxStackTraceLineLength=void 0};this.group_features=function(a){
|
|
60
|
-
a[
|
|
61
|
-
D+"]");switch(D){case 1:var a=g.DeviceIdType.SDK_GENERATED;break;case 3:case 0:a=g.DeviceIdType.DEVELOPER_SUPPLIED;break;case 2:a=g.DeviceIdType.TEMPORARY_ID;break;default:a=-1}return a};this.get_device_id=function(){
|
|
62
|
-
!0;for(var a in A)if(A[a]&&A[a].optin)return!0;
|
|
63
|
-
(
|
|
64
|
-
rb()):
|
|
65
|
-
D=2};this.disable_offline_mode=function(a){
|
|
66
|
-
this.begin_session=function(a,
|
|
67
|
-
e={begin_session:1},e.metrics=JSON.stringify(
|
|
68
|
-
F({end_session:1,session_duration:a})):this.session_duration(a),V=!1)};this.change_id=function(a,
|
|
69
|
-
!1));var e=this.device_id;this.device_id=a;D=0;v("cly_id",this.device_id);v("cly_id_type",0);
|
|
70
|
-
case "[CLY]_star_rating":
|
|
71
|
-
|
|
72
|
-
p({key:"[CLY]_orientation",segmentation:{mode:a||(window.innerWidth>window.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,
|
|
73
|
-
(a=a||y("cly_cmp_id")||"cly_organic",(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
g.maxValueSize,"userData set_once",
|
|
77
|
-
"multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
e=0;e<
|
|
81
|
-
"track_errors, Started tracking errors");n.i[this.app_key].tracking_crashes=!0;window.cly_crashes||(window.cly_crashes=!0,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"enrollUserToAb, An error occurred: "+
|
|
85
|
-
|
|
86
|
-
x(window,"pageshow",a);x(window,"pagehide",a);"onfocusin"in document&&(x(window,"focusin",a),x(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&&
|
|
87
|
-
"keydown",
|
|
88
|
-
else if(null===a)
|
|
89
|
-
"track_pageview",
|
|
90
|
-
segmentation:k}):W.track_pageview=arguments}};this.track_view=function(a,
|
|
91
|
-
y:e.pageY,width:l,height:k,view:g.getViewUrl()},e=
|
|
92
|
-
a&&
|
|
93
|
-
|
|
94
|
-
typeof l["input:"+e(f)]&&(l["input:"+e(f)]=[]),"select"===f.nodeName.toLowerCase()?"undefined"!==typeof f.multiple?l["input:"+e(f)].push(
|
|
95
|
-
l["input:"+e(f)].push(f.value):"undefined"!==typeof f.value&&l["input:"+e(f)].push(f.value));for(var q in l)l[q]&&"function"===typeof l[q].join&&(l[q]=l[q].join(", "))}g.check_consent("forms")&&p({key:"formSubmit",segmentation:l})})};this.collect_from_forms=function(a,
|
|
96
|
-
{},q=a.getElementsByTagName("LABEL"),t;for(t=0;t<q.length;t++)q[t].htmlFor&&""!==q[t].htmlFor&&(m[q[t].htmlFor]=q[t].innerText||q[t].textContent||q[t].innerHTML);for(t=0;t<e.elements.length;t++)if((f=e.elements[t])&&"password"!==f.type&&-1===f.className.indexOf("cly_user_ignore"))if(q="","select"===f.nodeName.toLowerCase()?q="undefined"!==typeof f.multiple?
|
|
97
|
-
f.type.toLowerCase()?f.checked&&(q=f.value):q=f.value:q=f.value:"textarea"===f.nodeName.toLowerCase()?q=f.value:"undefined"!==typeof f.value&&(q=f.value),f.className&&-1!==f.className.indexOf("cly_user_")){var
|
|
98
|
-
|
|
99
|
-
-1!==f.id.toLowerCase().indexOf("phone")||-1!==f.id.toLowerCase().indexOf("number"))||f.id&&m[f.id]&&(-1!==m[f.id].toLowerCase().indexOf("tel")||-1!==m[f.id].toLowerCase().indexOf("phone")||-1!==m[f.id].toLowerCase().indexOf("number")))k.phone||(k.phone=q),l=!0;else if(f.name&&(-1!==f.name.toLowerCase().indexOf("org")||-1!==f.name.toLowerCase().indexOf("company"))||
|
|
100
|
-
-1!==m[f.id].toLowerCase().indexOf("company")))k.organization||(k.organization=q),l=!0;else if(f.name&&-1!==f.name.toLowerCase().indexOf("name")||f.id&&-1!==f.id.toLowerCase().indexOf("name")||f.id&&m[f.id]&&-1!==m[f.id].toLowerCase().indexOf("name"))k.name||(k.name=""),k.name+=q+" ",l=!0}l&&(
|
|
101
|
-
FB&&FB.api&&FB.api("/me",function(
|
|
102
|
-
f)}}g.user_details(e)})};this.opt_out=function(){
|
|
103
|
-
this.recordRatingWidgetWithID(a)};this.recordRatingWidgetWithID=function(a){
|
|
104
|
-
(
|
|
105
|
-
this.reportFeedbackWidgetManually=function(a,
|
|
106
|
-
Math.round(e.rating);10<e.rating?(
|
|
107
|
-
"[CLY]_survey"}else if("rating"===
|
|
108
|
-
"reportFeedbackWidgetManually, Widget has an unacceptable type");return}a={key:l,count:1,segmentation:{widget_id:a._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};if(null===e)a.segmentation.closed=1;else{l=a.segmentation;if(k){for(var f,m=0,q=k.length;m<q;m++)f=k[m],"undefined"!==typeof e[f]&&(l[f]=e[f]);e=l}else e=void 0;a.segmentation=e}
|
|
109
|
-
else
|
|
110
|
-
(
|
|
111
|
-
this.initializeRatingWidgets(a)};this.initializeRatingWidgets=function(a){
|
|
112
|
-
e);else try{var f=JSON.parse(l);for(e=0;e<f.length;e++)if("true"===f[e].is_active){var m=f[e].target_devices,q=cb();if(m[q])if("string"===typeof f[e].hide_sticker&&(f[e].hide_sticker="true"===f[e].hide_sticker),"all"!==f[e].target_page||f[e].hide_sticker){var t=f[e].target_pages;for(k=0;k<t.length;k++){var
|
|
113
|
-
"initializeRatingWidgets, JSON parse error: "+
|
|
114
|
-
a.widgets),
|
|
115
|
-
!!a+"]");this.check_consent("feedback")?
|
|
116
|
-
f),a&&a(null,f)}},!1):a&&a(null,Error("Consent for feedback not provided."))};this.getFeedbackWidgetData=function(a,
|
|
117
|
-
if("nps"===a.type)e+="/o/surveys/nps/widget";else if("survey"===a.type)e+="/o/surveys/survey/widget";else if("rating"===a.type)e+="/o/surveys/rating/widget";else{
|
|
118
|
-
t),
|
|
58
|
+
g.maxValueSize=void 0;g.maxSegmentationValues=void 0;g.maxBreadcrumbCount=void 0;g.maxStackTraceLinesPerThread=void 0;g.maxStackTraceLineLength=void 0};this.group_features=function(a){c(d.INFO,"group_features, Grouping features");if(a)for(var b in a)A[b]?c(d.WARNING,"group_features, Feature name ["+b+"] is already reserved"):"string"===typeof a[b]?A[b]={features:[a[b]]}:a[b]&&Array.isArray(a[b])&&a[b].length?A[b]={features:a[b]}:c(d.ERROR,"group_features, Incorrect feature list for ["+b+"] value: ["+
|
|
59
|
+
a[b]+"]");else c(d.ERROR,"group_features, Incorrect features:["+a+"]")};this.check_consent=function(a){c(d.INFO,"check_consent, Checking if consent is given for specific feature:["+a+"]");if(!this.require_consent)return c(d.INFO,"check_consent, require_consent is off, no consent is necessary"),!0;if(A[a])return!(!A[a]||!A[a].optin);c(d.ERROR,"check_consent, No feature available for ["+a+"]");return!1};this.get_device_id_type=function(){c(d.INFO,"check_device_id_type, Retrieving the current device id type.["+
|
|
60
|
+
D+"]");switch(D){case 1:var a=g.DeviceIdType.SDK_GENERATED;break;case 3:case 0:a=g.DeviceIdType.DEVELOPER_SUPPLIED;break;case 2:a=g.DeviceIdType.TEMPORARY_ID;break;default:a=-1}return a};this.get_device_id=function(){c(d.INFO,"get_device_id, Retrieving the device id: ["+this.device_id+"]");return this.device_id};this.check_any_consent=function(){c(d.INFO,"check_any_consent, Checking if any consent is given");if(!this.require_consent)return c(d.INFO,"check_any_consent, require_consent is off, no consent is necessary"),
|
|
61
|
+
!0;for(var a in A)if(A[a]&&A[a].optin)return!0;c(d.INFO,"check_any_consent, No consents given");return!1};this.add_consent=function(a){c(d.INFO,"add_consent, Adding consent for ["+a+"]");if(Array.isArray(a))for(var b=0;b<a.length;b++)this.add_consent(a[b]);else A[a]?A[a].features?(A[a].optin=!0,this.add_consent(A[a].features)):!0!==A[a].optin&&(A[a].optin=!0,rb(),setTimeout(function(){"sessions"===a&&W.begin_session?(g.begin_session.apply(g,W.begin_session),W.begin_session=null):"views"===a&&W.track_pageview&&
|
|
62
|
+
(Q=null,g.track_pageview.apply(g,W.track_pageview),W.track_pageview=null)},1)):c(d.ERROR,"add_consent, No feature available for ["+a+"]")};this.remove_consent=function(a){c(d.INFO,"remove_consent, Removing consent for ["+a+"]");this.remove_consent_internal(a,!0)};this.remove_consent_internal=function(a,b){b=b||!1;if(Array.isArray(a))for(var e=0;e<a.length;e++)this.remove_consent_internal(a[e],b);else A[a]?A[a].features?this.remove_consent_internal(A[a].features,b):(A[a].optin=!1,b&&!1!==A[a].optin&&
|
|
63
|
+
rb()):c(d.ERROR,"remove_consent, No feature available for ["+a+"]")};var Na,rb=function(){Na&&(clearTimeout(Na),Na=null);Na=setTimeout(function(){for(var a={},b=0;b<n.features.length;b++)a[n.features[b]]=!0===A[n.features[b]].optin?!0:!1;F({consent:JSON.stringify(a)});c(d.DEBUG,"Consent update request has been sent to the queue.")},1E3)};this.enable_offline_mode=function(){c(d.INFO,"enable_offline_mode, Enabling offline mode");this.remove_consent_internal(n.features,!1);I=!0;this.device_id="[CLY]_temp_id";
|
|
64
|
+
D=2};this.disable_offline_mode=function(a){c(d.INFO,"disable_offline_mode, Disabling offline mode");I=!1;a&&this.device_id!==a?(this.device_id=a,D=0,v("cly_id",this.device_id),v("cly_id_type",0),c(d.INFO,"disable_offline_mode, Changing id to: "+this.device_id)):(this.device_id=Va(),this.device_id!==y("cly_id")&&(v("cly_id",this.device_id),v("cly_id_type",1)));a=!1;if(0<E.length)for(var b=0;b<E.length;b++)"[CLY]_temp_id"===E[b].device_id&&(E[b].device_id=this.device_id,a=!0);a&&v("cly_queue",E,!0)};
|
|
65
|
+
this.begin_session=function(a,b){c(d.INFO,"begin_session, Starting the session");a&&c(d.INFO,"begin_session, Heartbeats are disabled");b&&c(d.INFO,"begin_session, Session starts irrespective of session cookie");if(this.check_consent("sessions")){if(!V){this.enableOrientationTracking&&(this.report_orientation(),x(window,"resize",function(){g.report_orientation()}));ea=B();V=!0;ta=!a;var e=y("cly_session");if(b||!da||!e||parseInt(e)<=B())c(d.INFO,"begin_session, Session started"),null===na&&(na=!0),
|
|
66
|
+
e={begin_session:1},e.metrics=JSON.stringify(Da()),F(e);v("cly_session",B()+60*ua)}}else W.begin_session=arguments};this.session_duration=function(a){c(d.INFO,"session_duration, Reporting session duration");this.check_consent("sessions")&&V&&(c(d.INFO,"session_duration, Session extended: ",a),F({session_duration:a}),pa())};this.end_session=function(a,b){c(d.INFO,"end_session, Ending the current session");this.check_consent("sessions")&&V&&(a=a||B()-ea,Z(),!da||b?(c(d.INFO,"end_session, Session ended"),
|
|
67
|
+
F({end_session:1,session_duration:a})):this.session_duration(a),V=!1)};this.change_id=function(a,b){c(d.INFO,"change_id, Changing the ID");b&&c(d.INFO,"change_id, Will merge the IDs");if(!a||"string"!==typeof a||0===a.length)c(d.ERROR,"change_id, The provided ID: ["+a+"] is not a valid ID");else if(I)c(d.WARNING,"change_id, Offline mode was on, initiating disabling sequence instead."),this.disable_offline_mode(a);else if(this.device_id!==a){b||(J(),this.end_session(null,!0),ia={},this.remove_consent_internal(n.features,
|
|
68
|
+
!1));var e=this.device_id;this.device_id=a;D=0;v("cly_id",this.device_id);v("cly_id_type",0);c(d.INFO,"change_id, Changing ID from:["+e+"] to ["+a+"]");b?F({old_device_id:e}):this.begin_session(!ta,!0);this.remote_config&&(M={},v("cly_remote_configs",M),this.fetch_remote_config(this.remote_config))}};this.add_event=function(a){c(d.INFO,"add_event, Adding event: ",a);switch(a.key){case "[CLY]_nps":var b=this.check_consent("feedback");break;case "[CLY]_survey":b=this.check_consent("feedback");break;
|
|
69
|
+
case "[CLY]_star_rating":b=this.check_consent("star-rating");break;case "[CLY]_view":b=this.check_consent("views");break;case "[CLY]_orientation":b=this.check_consent("users");break;case "[CLY]_push_action":b=this.check_consent("push");break;case "[CLY]_action":b=this.check_consent("clicks")||this.check_consent("scroll");break;default:b=this.check_consent("events")}b&&p(a)};this.start_event=function(a){c(d.INFO,"start_event, Starting timed event with key: ["+a+"]");a=w(a,g.maxKeyLength,"start_event",
|
|
70
|
+
c);ia[a]?c(d.WARNING,"start_event, Timed event with key ["+a+"] already started"):ia[a]=B()};this.end_event=function(a){c(d.INFO,"end_event, Ending timed event");"string"===typeof a&&(a={key:a});a.key?ia[a.key]?(a.dur=B()-ia[a.key],this.add_event(a),delete ia[a.key]):c(d.ERROR,"end_event, Timed event with key ["+a.key+"] was not started"):c(d.ERROR,"end_event, Timed event must have a key property")};this.report_orientation=function(a){c(d.INFO,"report_orientation, Reporting orientation");this.check_consent("users")&&
|
|
71
|
+
p({key:"[CLY]_orientation",segmentation:{mode:a||(window.innerWidth>window.innerHeight?"landscape":"portrait")}})};this.report_conversion=function(a,b){c(d.WARNING,"report_conversion, Deprecated function call! Use 'recordDirectAttribution' in place of this call. Call will be redirected now!");this.recordDirectAttribution(a,b)};this.recordDirectAttribution=function(a,b){c(d.INFO,"recordDirectAttribution, Recording the attribution for campaign ID: ["+a+"] and the user ID: ["+b+"]");this.check_consent("attribution")&&
|
|
72
|
+
(a=a||y("cly_cmp_id")||"cly_organic",(b=b||y("cly_cmp_uid"))?F({campaign_id:a,campaign_user:b}):F({campaign_id:a}))};this.user_details=function(a){c(d.INFO,"user_details, Trying to add user details: ",a);this.check_consent("users")&&(a.name=w(a.name,g.maxValueSize,"user_details",c),a.username=w(a.username,g.maxValueSize,"user_details",c),a.email=w(a.email,g.maxValueSize,"user_details",c),a.organization=w(a.organization,g.maxValueSize,"user_details",c),a.phone=w(a.phone,g.maxValueSize,"user_details",
|
|
73
|
+
c),a.picture=w(a.picture,4096,"user_details",c),a.gender=w(a.gender,g.maxValueSize,"user_details",c),a.byear=w(a.byear,g.maxValueSize,"user_details",c),a.custom=U(a.custom,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"user_details",c),F({user_details:JSON.stringify(oa(a,"name username email organization phone picture gender byear custom".split(" ")))}))};var T={},X=function(a,b,e){g.check_consent("users")&&(T[a]||(T[a]={}),"$push"===e||"$pull"===e||"$addToSet"===e?(T[a][e]||(T[a][e]=[]),
|
|
74
|
+
T[a][e].push(b)):T[a][e]=b)};this.userData={set:function(a,b){c(d.INFO,"set, Setting user's custom property value: ["+b+"] under the key: ["+a+"]");a=w(a,g.maxKeyLength,"userData set",c);b=w(b,g.maxValueSize,"userData set",c);T[a]=b},unset:function(a){c(d.INFO,"unset, Resetting user's custom property with key: ["+a+"] ");T[a]=""},set_once:function(a,b){c(d.INFO,"set_once, Setting user's unique custom property value: ["+b+"] under the key: ["+a+"] ");a=w(a,g.maxKeyLength,"userData set_once",c);b=w(b,
|
|
75
|
+
g.maxValueSize,"userData set_once",c);X(a,b,"$setOnce")},increment:function(a){c(d.INFO,"increment, Increasing user's custom property value under the key: ["+a+"] by one");a=w(a,g.maxKeyLength,"userData increment",c);X(a,1,"$inc")},increment_by:function(a,b){c(d.INFO,"increment_by, Increasing user's custom property value under the key: ["+a+"] by: ["+b+"]");a=w(a,g.maxKeyLength,"userData increment_by",c);b=w(b,g.maxValueSize,"userData increment_by",c);X(a,b,"$inc")},multiply:function(a,b){c(d.INFO,
|
|
76
|
+
"multiply, Multiplying user's custom property value under the key: ["+a+"] by: ["+b+"]");a=w(a,g.maxKeyLength,"userData multiply",c);b=w(b,g.maxValueSize,"userData multiply",c);X(a,b,"$mul")},max:function(a,b){c(d.INFO,"max, Saving user's maximum custom property value compared to the value: ["+b+"] under the key: ["+a+"]");a=w(a,g.maxKeyLength,"userData max",c);b=w(b,g.maxValueSize,"userData max",c);X(a,b,"$max")},min:function(a,b){c(d.INFO,"min, Saving user's minimum custom property value compared to the value: ["+
|
|
77
|
+
b+"] under the key: ["+a+"]");a=w(a,g.maxKeyLength,"userData min",c);b=w(b,g.maxValueSize,"userData min",c);X(a,b,"$min")},push:function(a,b){c(d.INFO,"push, Pushing a value: ["+b+"] under the key: ["+a+"] to user's custom property array");a=w(a,g.maxKeyLength,"userData push",c);b=w(b,g.maxValueSize,"userData push",c);X(a,b,"$push")},push_unique:function(a,b){c(d.INFO,"push_unique, Pushing a unique value: ["+b+"] under the key: ["+a+"] to user's custom property array");a=w(a,g.maxKeyLength,"userData push_unique",
|
|
78
|
+
c);b=w(b,g.maxValueSize,"userData push_unique",c);X(a,b,"$addToSet")},pull:function(a,b){c(d.INFO,"pull, Removing the value: ["+b+"] under the key: ["+a+"] from user's custom property array");X(a,b,"$pull")},save:function(){c(d.INFO,"save, Saving changes to user's custom property");g.check_consent("users")&&F({user_details:JSON.stringify({custom:T})});T={}}};this.report_trace=function(a){c(d.INFO,"report_trace, Reporting performance trace");if(this.check_consent("apm")){for(var b="type name stz etz apm_metrics apm_attr".split(" "),
|
|
79
|
+
e=0;e<b.length;e++)if("apm_attr"!==b[e]&&"undefined"===typeof a[b[e]]){c(d.WARNING,"report_trace, APM trace don't have the property: "+b[e]);return}a.name=w(a.name,g.maxKeyLength,"report_trace",c);a.app_metrics=U(a.app_metrics,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"report_trace",c);b=oa(a,b);b.timestamp=a.stz;a=new Date;b.hour=a.getHours();b.dow=a.getDay();F({apm:JSON.stringify(b)});c(d.INFO,"report_trace, Successfully adding APM trace: ",b)}};this.track_errors=function(a){c(d.INFO,
|
|
80
|
+
"track_errors, Started tracking errors");n.i[this.app_key].tracking_crashes=!0;window.cly_crashes||(window.cly_crashes=!0,Xa=a,window.onerror=function q(e,k,l,f,m){if(void 0!==m&&null!==m)Ra(m,!1);else{f=f||window.event&&window.event.errorCharacter;m="";"undefined"!==typeof e&&(m+=e+"\n");"undefined"!==typeof k&&(m+="at "+k);"undefined"!==typeof l&&(m+=":"+l);"undefined"!==typeof f&&(m+=":"+f);m+="\n";try{e=[];for(var t=q.caller;t;)e.push(t.name),t=t.caller;m+=e.join("\n")}catch(H){c(d.ERROR,"track_errors, Call stack generation experienced a problem: "+
|
|
81
|
+
H)}Ra(m,!1)}},window.addEventListener("unhandledrejection",function(e){Ra(Error("Unhandled rejection (reason: "+(e.reason&&e.reason.stack?e.reason.stack:e.reason)+")."),!0)}))};this.log_error=function(a,b){c(d.INFO,"log_error, Logging errors");this.recordError(a,!0,b)};this.add_log=function(a){c(d.INFO,"add_log, Adding a new log of breadcrumbs: [ "+a+" ]");if(this.check_consent("crashes")){for(a=w(a,g.maxValueSize,"add_log",c);ha.length>=g.maxBreadcrumbCount;)ha.shift(),c(d.WARNING,"add_log, Reached maximum crashLogs size. Will erase the oldest one.");
|
|
82
|
+
ha.push(a)}};this.fetch_remote_config=function(a,b,e){var k=null,l=null,f=null;a&&(e||"function"!==typeof a?Array.isArray(a)&&(k=a):f=a);b&&(e||"function"!==typeof b?Array.isArray(b)&&(l=b):f=b);f||"function"!==typeof e||(f=e);this.useExplicitRcApi?(c(d.INFO,"fetch_remote_config, Fetching remote config"),u(k,l,this.rcAutoOptinAb?1:0,null,f)):(c(d.WARNING,"fetch_remote_config, Fetching remote config, with legacy API"),u(k,l,null,"legacy",f))};this.enrollUserToAb=function(a){c(d.INFO,"enrollUserToAb, Providing AB test keys to opt in for");
|
|
83
|
+
a&&Array.isArray(a)&&0!==a.length?(a={method:"ab",keys:JSON.stringify(a)},ba(a),aa("enrollUserToAb",this.url+Ea,a,function(b,e,k){if(b)c(d.ERROR,"enrollUserToAb, An error occurred: "+b);else try{var l=JSON.parse(k);c(d.DEBUG,"enrollUserToAb, Parsed the response's result: ["+l.result+"]")}catch(f){c(d.ERROR,"enrollUserToAb, Had an issue while parsing the response: "+f)}},!0)):c(d.ERROR,"enrollUserToAb, No keys provided")};this.get_remote_config=function(a){c(d.INFO,"get_remote_config, Getting remote config from storage");
|
|
84
|
+
return"undefined"!==typeof a?M[a]:M};this.stop_time=function(){c(d.INFO,"stop_time, Stopping tracking duration");ca&&(ca=!1,Ya=B()-ea,sa=B()-ra)};this.start_time=function(){c(d.INFO,"start_time, Starting tracking duration");ca||(ca=!0,ea=B()-Ya,ra=B()-sa,sa=0,pa())};this.track_sessions=function(){function a(){document[e]||!document.hasFocus()?g.stop_time():g.start_time()}function b(){za>=ya&&g.start_time();za=0}c(d.INFO,"track_session, Starting tracking user session");this.begin_session();this.start_time();
|
|
85
|
+
x(window,"beforeunload",function(){J();g.end_session()});var e="hidden";x(window,"focus",a);x(window,"blur",a);x(window,"pageshow",a);x(window,"pagehide",a);"onfocusin"in document&&(x(window,"focusin",a),x(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&&
|
|
86
|
+
(e="msHidden",document.addEventListener("msvisibilitychange",a));x(window,"mousemove",b);x(window,"click",b);x(window,"keydown",b);x(window,"scroll",b);setInterval(function(){za++;za>=ya&&g.stop_time()},6E4)};this.track_pageview=function(a,b,e){c(d.INFO,"track_pageview, Tracking page views");c(d.VERBOSE,"track_pageview, last view is:["+Q+"]");Q&&(c(d.DEBUG,"track_pageview, Scroll registry triggered"),Wa(),xa=!0,wa=0);Z();(a=w(a,g.maxKeyLength,"track_pageview",c))&&Array.isArray(a)&&(b=a,a=null);a||
|
|
87
|
+
(a=this.getViewName());if(void 0===a||""===a)c(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)c(d.ERROR,"track_pageview, View name returned as null. Page view will be ignored.");else{if(b&&b.length)for(var k=0;k<b.length;k++)try{if((new RegExp(b[k])).test(a)){c(d.INFO,"track_pageview, Ignoring the page: "+a);return}}catch(m){c(d.ERROR,"track_pageview, Problem with finding ignore list item: "+b[k]+", error: "+
|
|
88
|
+
m)}Q=a;ra=B();c(d.VERBOSE,"track_pageview, last view is assigned:["+Q+"]");k={name:a,visit:1,view:g.getViewUrl()};k=U(k,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"track_pageview",c);this.track_domains&&(k.domain=window.location.hostname);if(da)if(V)na&&(na=!1,k.start=1);else{var l=y("cly_session");if(!l||parseInt(l)<=B())na=!1,k.start=1}else"undefined"!==typeof document.referrer&&document.referrer.length&&(l=jb.exec(document.referrer))&&l[11]&&l[11]!==window.location.hostname&&(k.start=
|
|
89
|
+
1);if(e){e=U(e,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"track_pageview",c);for(var f in e)"undefined"===typeof k[f]&&(k[f]=e[f])}this.check_consent("views")?p({key:"[CLY]_view",segmentation:k}):W.track_pageview=arguments}};this.track_view=function(a,b,e){c(d.INFO,"track_view, Initiating tracking page views");this.track_pageview(a,b,e)};this.track_clicks=function(a){c(d.INFO,"track_clicks, Starting to track clicks");a&&c(d.INFO,"track_clicks, Tracking the specified children:["+a+"]");
|
|
90
|
+
a=a||document;var b=!0;x(a,"click",function(e){if(b){b=!1;Sa(e);if("undefined"!==typeof e.pageX&&"undefined"!==typeof e.pageY){var k=Ba(),l=Ta();g.check_consent("clicks")&&(e={type:"click",x:e.pageX,y:e.pageY,width:l,height:k,view:g.getViewUrl()},e=U(e,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"processClick",c),g.track_domains&&(e.domain=window.location.hostname),p({key:"[CLY]_action",segmentation:e}))}setTimeout(function(){b=!0},1E3)}})};this.track_scrolls=function(a){c(d.INFO,"track_scrolls, Starting to track scrolls");
|
|
91
|
+
a&&c(d.INFO,"track_scrolls, Tracking the specified children");a=a||window;xa=!0;x(a,"scroll",nb);x(a,"beforeunload",Wa)};this.track_links=function(a){c(d.INFO,"track_links, Starting to track clicks to links");a&&c(d.INFO,"track_links, Tracking the specified children");a=a||document;x(a,"click",function(b){a:{var e=Oa(b);var k;for(k="A";e;){if(e.nodeName.toUpperCase()===k)break a;e=e.parentElement}e=void 0}e&&(Sa(b),g.check_consent("clicks")&&p({key:"linkClick",segmentation:{href:e.href,text:e.innerText,
|
|
92
|
+
id:e.id,view:g.getViewUrl()}}))})};this.track_forms=function(a,b){function e(k){return k.name||k.id||k.type||k.nodeName}c(d.INFO,"track_forms, Starting to track form submissions. DOM object provided:["+!!a+"] Tracking hidden inputs :["+!!b+"]");a=a||document;x(a,"submit",function(k){k=Oa(k);var l={id:k.attributes.id&&k.attributes.id.nodeValue,name:k.attributes.name&&k.attributes.name.nodeValue,action:k.attributes.action&&k.attributes.action.nodeValue,method:k.attributes.method&&k.attributes.method.nodeValue,
|
|
93
|
+
view:g.getViewUrl()},f;if("undefined"!==typeof k.elements){for(var m=0;m<k.elements.length;m++)(f=k.elements[m])&&"password"!==f.type&&-1===f.className.indexOf("cly_user_ignore")&&("undefined"===typeof l["input:"+e(f)]&&(l["input:"+e(f)]=[]),"select"===f.nodeName.toLowerCase()?"undefined"!==typeof f.multiple?l["input:"+e(f)].push(ja(f)):l["input:"+e(f)].push(f.options[f.selectedIndex].value):"input"===f.nodeName.toLowerCase()?"undefined"!==typeof f.type?"checkbox"===f.type.toLowerCase()||"radio"===
|
|
94
|
+
f.type.toLowerCase()?f.checked&&l["input:"+e(f)].push(f.value):("hidden"!==f.type.toLowerCase()||b)&&l["input:"+e(f)].push(f.value):l["input:"+e(f)].push(f.value):"textarea"===f.nodeName.toLowerCase()?l["input:"+e(f)].push(f.value):"undefined"!==typeof f.value&&l["input:"+e(f)].push(f.value));for(var q in l)l[q]&&"function"===typeof l[q].join&&(l[q]=l[q].join(", "))}g.check_consent("forms")&&p({key:"formSubmit",segmentation:l})})};this.collect_from_forms=function(a,b){c(d.INFO,"collect_from_forms, Starting to collect possible user data. DOM object provided:["+
|
|
95
|
+
!!a+"] Submitting custom user property:["+!!b+"]");a=a||document;x(a,"submit",function(e){e=Oa(e);var k={},l=!1,f;if("undefined"!==typeof e.elements){var m={},q=a.getElementsByTagName("LABEL"),t;for(t=0;t<q.length;t++)q[t].htmlFor&&""!==q[t].htmlFor&&(m[q[t].htmlFor]=q[t].innerText||q[t].textContent||q[t].innerHTML);for(t=0;t<e.elements.length;t++)if((f=e.elements[t])&&"password"!==f.type&&-1===f.className.indexOf("cly_user_ignore"))if(q="","select"===f.nodeName.toLowerCase()?q="undefined"!==typeof f.multiple?
|
|
96
|
+
ja(f):f.options[f.selectedIndex].value:"input"===f.nodeName.toLowerCase()?"undefined"!==typeof f.type?"checkbox"===f.type.toLowerCase()||"radio"===f.type.toLowerCase()?f.checked&&(q=f.value):q=f.value:q=f.value:"textarea"===f.nodeName.toLowerCase()?q=f.value:"undefined"!==typeof f.value&&(q=f.value),f.className&&-1!==f.className.indexOf("cly_user_")){var H=f.className.split(" ");for(f=0;f<H.length;f++)if(0===H[f].indexOf("cly_user_")){k[H[f].replace("cly_user_","")]=q;l=!0;break}}else if(f.type&&
|
|
97
|
+
"email"===f.type.toLowerCase()||f.name&&-1!==f.name.toLowerCase().indexOf("email")||f.id&&-1!==f.id.toLowerCase().indexOf("email")||f.id&&m[f.id]&&-1!==m[f.id].toLowerCase().indexOf("email")||/[^@\s]+@[^@\s]+\.[^@\s]+/.test(q))k.email||(k.email=q),l=!0;else if(f.name&&-1!==f.name.toLowerCase().indexOf("username")||f.id&&-1!==f.id.toLowerCase().indexOf("username")||f.id&&m[f.id]&&-1!==m[f.id].toLowerCase().indexOf("username"))k.username||(k.username=q),l=!0;else if(f.name&&(-1!==f.name.toLowerCase().indexOf("tel")||
|
|
98
|
+
-1!==f.name.toLowerCase().indexOf("phone")||-1!==f.name.toLowerCase().indexOf("number"))||f.id&&(-1!==f.id.toLowerCase().indexOf("tel")||-1!==f.id.toLowerCase().indexOf("phone")||-1!==f.id.toLowerCase().indexOf("number"))||f.id&&m[f.id]&&(-1!==m[f.id].toLowerCase().indexOf("tel")||-1!==m[f.id].toLowerCase().indexOf("phone")||-1!==m[f.id].toLowerCase().indexOf("number")))k.phone||(k.phone=q),l=!0;else if(f.name&&(-1!==f.name.toLowerCase().indexOf("org")||-1!==f.name.toLowerCase().indexOf("company"))||
|
|
99
|
+
f.id&&(-1!==f.id.toLowerCase().indexOf("org")||-1!==f.id.toLowerCase().indexOf("company"))||f.id&&m[f.id]&&(-1!==m[f.id].toLowerCase().indexOf("org")||-1!==m[f.id].toLowerCase().indexOf("company")))k.organization||(k.organization=q),l=!0;else if(f.name&&-1!==f.name.toLowerCase().indexOf("name")||f.id&&-1!==f.id.toLowerCase().indexOf("name")||f.id&&m[f.id]&&-1!==m[f.id].toLowerCase().indexOf("name"))k.name||(k.name=""),k.name+=q+" ",l=!0}l&&(c(d.INFO,"collect_from_forms, Gathered user data",k),b?g.user_details({custom:k}):
|
|
100
|
+
g.user_details(k))})};this.collect_from_facebook=function(a){c(d.INFO,"collect_from_facebook, Starting to collect possible user data");FB&&FB.api&&FB.api("/me",function(b){var e={};b.name&&(e.name=b.name);b.email&&(e.email=b.email);"male"===b.gender?e.gender="M":"female"===b.gender&&(e.gender="F");if(b.birthday){var k=b.birthday.split("/").pop();k&&4===k.length&&(e.byear=k)}b.work&&b.work[0]&&b.work[0].employer&&b.work[0].employer.name&&(e.organization=b.work[0].employer.name);if(a){e.custom={};for(var l in a){k=
|
|
101
|
+
a[l].split(".");for(var f=b,m=0;m<k.length&&(f=f[k[m]],"undefined"!==typeof f);m++);"undefined"!==typeof f&&(e.custom[l]=f)}}g.user_details(e)})};this.opt_out=function(){c(d.INFO,"opt_out, Opting out the user");this.ignore_visitor=!0;v("cly_ignore",!0)};this.opt_in=function(){c(d.INFO,"opt_in, Opting in the user");v("cly_ignore",!1);this.ignore_visitor=!1;C();this.ignore_visitor||Ha||Ga()};this.report_feedback=function(a){c(d.WARNING,"report_feedback, Deprecated function call! Use 'recordRatingWidgetWithID' or 'reportFeedbackWidgetManually' in place of this call. Call will be redirected to 'recordRatingWidgetWithID' now!");
|
|
102
|
+
this.recordRatingWidgetWithID(a)};this.recordRatingWidgetWithID=function(a){c(d.INFO,"recordRatingWidgetWithID, Providing information about user with ID: [ "+a.widget_id+" ]");if(this.check_consent("star-rating"))if(a.widget_id)if(a.rating){var b={key:"[CLY]_star_rating",count:1,segmentation:{}};b.segmentation=oa(a,"widget_id contactMe platform app_version rating email comment".split(" "));b.segmentation.app_version||(b.segmentation.app_version=this.metrics._app_version||this.app_version);5<b.segmentation.rating?
|
|
103
|
+
(c(d.WARNING,"recordRatingWidgetWithID, You have entered a rating higher than 5. Changing it back to 5 now."),b.segmentation.rating=5):1>b.segmentation.rating&&(c(d.WARNING,"recordRatingWidgetWithID, You have entered a rating lower than 1. Changing it back to 1 now."),b.segmentation.rating=1);c(d.INFO,"recordRatingWidgetWithID, Reporting Rating Widget: ",b);p(b)}else c(d.ERROR,"recordRatingWidgetWithID, Rating Widget must contain rating property");else c(d.ERROR,"recordRatingWidgetWithID, Rating Widget must contain widget_id property")};
|
|
104
|
+
this.reportFeedbackWidgetManually=function(a,b,e){if(this.check_consent("feedback"))if(a&&b)if(a._id)if(I)c(d.ERROR,"reportFeedbackWidgetManually, Feedback Widgets can not be reported in offline mode");else{c(d.INFO,"reportFeedbackWidgetManually, Providing information about user with, provided result of the widget with ID: [ "+a._id+" ] and type: ["+a.type+"]");var k=[];b=a.type;if("nps"===b){if(e){if(!e.rating){c(d.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");return}e.rating=
|
|
105
|
+
Math.round(e.rating);10<e.rating?(c(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 10. Changing it back to 10 now."),e.rating=10):0>e.rating&&(c(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 0. Changing it back to 0 now."),e.rating=0);k=["rating","comment"]}var l="[CLY]_nps"}else if("survey"===b){if(e){if(1>Object.keys(e).length){c(d.ERROR,"reportFeedbackWidgetManually, Widget should have answers to be reported");return}k=Object.keys(e)}l=
|
|
106
|
+
"[CLY]_survey"}else if("rating"===b){if(e){if(!e.rating){c(d.ERROR,"reportFeedbackWidgetManually, Widget must contain rating property");return}e.rating=Math.round(e.rating);5<e.rating?(c(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating higher than 5. Changing it back to 5 now."),e.rating=5):1>e.rating&&(c(d.WARNING,"reportFeedbackWidgetManually, You have entered a rating lower than 1. Changing it back to 1 now."),e.rating=1);k=["rating","comment","email","contactMe"]}l="[CLY]_star_rating"}else{c(d.ERROR,
|
|
107
|
+
"reportFeedbackWidgetManually, Widget has an unacceptable type");return}a={key:l,count:1,segmentation:{widget_id:a._id,platform:this.platform,app_version:this.metrics._app_version||this.app_version}};if(null===e)a.segmentation.closed=1;else{l=a.segmentation;if(k){for(var f,m=0,q=k.length;m<q;m++)f=k[m],"undefined"!==typeof e[f]&&(l[f]=e[f]);e=l}else e=void 0;a.segmentation=e}c(d.INFO,"reportFeedbackWidgetManually, Reporting "+b+": ",a);p(a)}else c(d.ERROR,"reportFeedbackWidgetManually, Feedback Widgets must contain _id property");
|
|
108
|
+
else c(d.ERROR,"reportFeedbackWidgetManually, Widget data and/or Widget object not provided. Aborting.")};this.show_feedback_popup=function(a){c(d.WARNING,"show_feedback_popup, Deprecated function call! Use 'presentRatingWidgetWithID' in place of this call. Call will be redirected now!");this.presentRatingWidgetWithID(a)};this.presentRatingWidgetWithID=function(a){c(d.INFO,"presentRatingWidgetWithID, Showing rating widget popup for the widget with ID: [ "+a+" ]");this.check_consent("star-rating")&&
|
|
109
|
+
(I?c(d.ERROR,"presentRatingWidgetWithID, Cannot show ratingWidget popup in offline mode"):aa("presentRatingWidgetWithID",this.url+"/o/feedback/widget",{widget_id:a},function(b,e,k){if(b)c(d.ERROR,"presentRatingWidgetWithID, An error occurred: "+b);else try{var l=JSON.parse(k);O(l,!1)}catch(f){c(d.ERROR,"presentRatingWidgetWithID, JSON parse failed: "+f)}},!0))};this.initialize_feedback_popups=function(a){c(d.WARNING,"initialize_feedback_popups, Deprecated function call! Use 'initializeRatingWidgets' in place of this call. Call will be redirected now!");
|
|
110
|
+
this.initializeRatingWidgets(a)};this.initializeRatingWidgets=function(a){c(d.INFO,"initializeRatingWidgets, Initializing rating widget with provided widget IDs:[ "+a+"]");if(this.check_consent("star-rating")){a||(a=y("cly_fb_widgets"));for(var b=document.getElementsByClassName("countly-feedback-sticker");0<b.length;)b[0].remove();aa("initializeRatingWidgets",this.url+"/o/feedback/multiple-widgets-by-id",{widgets:JSON.stringify(a)},function(e,k,l){if(e)c(d.ERROR,"initializeRatingWidgets, An error occurred: "+
|
|
111
|
+
e);else try{var f=JSON.parse(l);for(e=0;e<f.length;e++)if("true"===f[e].is_active){var m=f[e].target_devices,q=cb();if(m[q])if("string"===typeof f[e].hide_sticker&&(f[e].hide_sticker="true"===f[e].hide_sticker),"all"!==f[e].target_page||f[e].hide_sticker){var t=f[e].target_pages;for(k=0;k<t.length;k++){var H=t[k].substr(0,t[k].length-1)===window.location.pathname.substr(0,t[k].length-1),P=t[k]===window.location.pathname;(t[k].includes("*")&&H||P)&&!f[e].hide_sticker&&O(f[e],!0)}}else O(f[e],!0)}}catch(K){c(d.ERROR,
|
|
112
|
+
"initializeRatingWidgets, JSON parse error: "+K)}},!0)}};this.enable_feedback=function(a){c(d.WARNING,"enable_feedback, Deprecated function call! Use 'enableRatingWidgets' in place of this call. Call will be redirected now!");this.enableRatingWidgets(a)};this.enableRatingWidgets=function(a){c(d.INFO,"enableRatingWidgets, Enabling rating widget with params:",a);this.check_consent("star-rating")&&(I?c(d.ERROR,"enableRatingWidgets, Cannot enable rating widgets in offline mode"):(v("cly_fb_widgets",a.popups||
|
|
113
|
+
a.widgets),Ca(this.url+"/star-rating/stylesheets/countly-feedback-web.css"),a=a.popups||a.widgets,0<a.length?(document.body.insertAdjacentHTML("beforeend",'<div id="cfbg"></div>'),this.initializeRatingWidgets(a)):c(d.ERROR,"enableRatingWidgets, You should provide at least one widget id as param. Read documentation for more detail. https://resources.count.ly/plugins/feedback")))};this.get_available_feedback_widgets=function(a){c(d.INFO,"get_available_feedback_widgets, Getting the feedback list, callback function is provided:["+
|
|
114
|
+
!!a+"]");this.check_consent("feedback")?I?c(d.ERROR,"get_available_feedback_widgets, Cannot enable feedback widgets in offline mode."):aa("get_available_feedback_widgets",this.url+Ea,{method:"feedback",device_id:this.device_id,app_key:this.app_key},function(b,e,k){if(b)c(d.ERROR,"get_available_feedback_widgets, Error occurred while fetching feedbacks: "+b),a&&a(null,b);else try{var l=JSON.parse(k).result||[];a&&a(l,null)}catch(f){c(d.ERROR,"get_available_feedback_widgets, Error while parsing feedback widgets list: "+
|
|
115
|
+
f),a&&a(null,f)}},!1):a&&a(null,Error("Consent for feedback not provided."))};this.getFeedbackWidgetData=function(a,b){if(a.type)if(c(d.INFO,"getFeedbackWidgetData, Retrieving data for: ["+JSON.stringify(a)+"], callback function is provided:["+!!b+"]"),this.check_consent("feedback"))if(I)c(d.ERROR,"getFeedbackWidgetData, Cannot enable feedback widgets in offline mode.");else{var e=this.url,k={widget_id:a._id,shown:1,sdk_version:"22.06.4",sdk_name:"javascript_native_web",platform:this.platform,app_version:this.app_version};
|
|
116
|
+
if("nps"===a.type)e+="/o/surveys/nps/widget";else if("survey"===a.type)e+="/o/surveys/survey/widget";else if("rating"===a.type)e+="/o/surveys/rating/widget";else{c(d.ERROR,"getFeedbackWidgetData, Unknown type info: ["+a.type+"]");return}aa("getFeedbackWidgetData",e,k,function(l,f,m){if(l)c(d.ERROR,"getFeedbackWidgetData, Error occurred while fetching feedbacks: "+l),b&&b(null,l);else try{var q=JSON.parse(m);b&&b(q,null)}catch(t){c(d.ERROR,"getFeedbackWidgetData, Error while parsing feedback widgets list: "+
|
|
117
|
+
t),b&&b(null,t)}},!0)}else b&&b(null,Error("Consent for feedback not provided."));else c(d.ERROR,"getFeedbackWidgetData, Expected the provided widget object to have a type but got: ["+JSON.stringify(a)+"], aborting.")};this.present_feedback_widget=function(a,b,e){function k(z){document.getElementById("countly-surveys-wrapper-"+z._id).style.display="block";document.getElementById("csbg").style.display="block"}function l(z){if(!z.appearance.hideS){c(d.DEBUG,"present_feedback_widget, handling the sticker as it was not set to hidden");
|
|
119
118
|
var N=document.createElement("div");N.innerText=z.appearance.text;N.style.color=7>z.appearance.text_color.length?"#"+z.appearance.text_color:z.appearance.text_color;N.style.backgroundColor=7>z.appearance.bg_color.length?"#"+z.appearance.bg_color:z.appearance.bg_color;N.className="countly-feedback-sticker "+z.appearance.position+"-"+z.appearance.size;N.id="countly-feedback-sticker-"+z._id;document.body.appendChild(N);x(document.getElementById("countly-feedback-sticker-"+z._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+
|
|
120
|
-
z._id).style.display="flex";document.getElementById("csbg").style.display="block"})}x(document.getElementById("countly-feedback-close-icon-"+z._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+z._id).style.display="none";document.getElementById("csbg").style.display="none"})}
|
|
121
|
-
Array.isArray(a))
|
|
122
|
-
return}var m=window.origin||window.location.origin;if("rating"===a.type){
|
|
123
|
-
this.platform;f+="&app_version="+this.app_version;f+="&sdk_version=22.06.
|
|
124
|
-
|
|
125
|
-
f||e&&(document.getElementsByClassName(e)[0]?
|
|
126
|
-
a._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+a._id).style.display="none"})}
|
|
127
|
-
"none"):
|
|
128
|
-
function(z){"complete"===z.target.readyState&&x(document,"mouseleave",function(){L||(L=!0,k(a))})});break;case "onScrollHalfwayDown":x(window,"scroll",function(){if(!L){var z=Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop),N=
|
|
129
|
-
!1;"complete"===document.readyState?
|
|
130
|
-
(k+=a.message+"\n"),"undefined"!==typeof a.fileName&&(k+="in "+a.fileName+"\n"),"undefined"!==typeof a.lineNumber&&(k+="on "+a.lineNumber),"undefined"!==typeof a.columnNumber&&(k+=":"+a.columnNumber)):k=a+"";if(k.length>g.maxStackTraceLineLength*g.maxStackTraceLinesPerThread){
|
|
131
|
-
(k
|
|
132
|
-
"undefined"!==typeof e&&(e=
|
|
133
|
-
"[]");break;case "cly_remote_configs":M=g.deserialize(
|
|
134
|
-
getMsTimestamp:
|
|
135
|
-
add_cly_events:p,processScrollView:
|
|
136
|
-
typeof h.addEventListener?h.addEventListener(p,u,!1):h.attachEvent("on"+p,u)},
|
|
137
|
-
n.getViewUrl=function(){return window.location.pathname};n.getSearchQuery=function(){return window.location.search};n.DeviceIdType={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2};return n}});
|
|
119
|
+
z._id).style.display="flex";document.getElementById("csbg").style.display="block"})}x(document.getElementById("countly-feedback-close-icon-"+z._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+z._id).style.display="none";document.getElementById("csbg").style.display="none"})}c(d.INFO,"present_feedback_widget, Presenting the feedback widget by appending to the element with ID: [ "+b+" ] and className: [ "+e+" ]");if(this.check_consent("feedback"))if(!a||"object"!==typeof a||
|
|
120
|
+
Array.isArray(a))c(d.ERROR,"present_feedback_widget, Please provide at least one feedback widget object.");else try{var f=this.url;if("nps"===a.type)c(d.DEBUG,"present_feedback_widget, Widget type: nps."),f+="/feedback/nps";else if("survey"===a.type)c(d.DEBUG,"present_feedback_widget, Widget type: survey."),f+="/feedback/survey";else if("rating"===a.type)c(d.DEBUG,"present_feedback_widget, Widget type: rating."),f+="/feedback/rating";else{c(d.ERROR,"present_feedback_widget, Feedback widget only accepts nps, rating and survey types.");
|
|
121
|
+
return}var m=window.origin||window.location.origin;if("rating"===a.type){c(d.DEBUG,"present_feedback_widget, Loading css for rating widget.");var q="ratings";Ca(this.url+"/star-rating/stylesheets/countly-feedback-web.css")}else c(d.DEBUG,"present_feedback_widget, Loading css for survey or nps."),Ca(this.url+"/surveys/stylesheets/countly-surveys.css"),q="surveys";f+="?widget_id="+a._id;f+="&app_key="+this.app_key;f+="&device_id="+this.device_id;f+="&sdk_name=javascript_native_web";f+="&platform="+
|
|
122
|
+
this.platform;f+="&app_version="+this.app_version;f+="&sdk_version=22.06.4";f+="&origin="+m;f+="&widget_v=web";var t=document.createElement("iframe");t.src=f;t.name="countly-"+q+"-iframe";t.id="countly-"+q+"-iframe";var H=!1;t.onload=function(){H&&(document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display="none");H=!0;c(d.DEBUG,"present_feedback_widget, Loaded iframe.")};for(var P=document.getElementById("csbg");P;)P.remove(),P=document.getElementById("csbg"),
|
|
123
|
+
c(d.DEBUG,"present_feedback_widget, Removing past overlay.");var K=document.getElementsByClassName("countly-"+q+"-wrapper");for(f=0;f<K.length;f++)K[f].remove(),c(d.DEBUG,"present_feedback_widget, Removed a wrapper.");K=document.createElement("div");K.className="countly-"+q+"-wrapper";K.id="countly-"+q+"-wrapper-"+a._id;"survey"===a.type&&(K.className=K.className+" "+a.appearance.position);var la=document.body;f=!1;b&&(document.getElementById(b)?(la=document.getElementById(b),f=!0):c(d.ERROR,"present_feedback_widget, Provided ID not found."));
|
|
124
|
+
f||e&&(document.getElementsByClassName(e)[0]?la=document.getElementsByClassName(e)[0]:c(d.ERROR,"present_feedback_widget, Provided class not found."));la.insertAdjacentHTML("beforeend",'<div id="csbg"></div>');la.appendChild(K);if("rating"===a.type){var $a=document.createElement("div");$a.className="countly-ratings-overlay";$a.id="countly-ratings-overlay-"+a._id;K.appendChild($a);c(d.DEBUG,"present_feedback_widget, appended the rating overlay to wrapper");x(document.getElementById("countly-ratings-overlay-"+
|
|
125
|
+
a._id),"click",function(){document.getElementById("countly-ratings-wrapper-"+a._id).style.display="none"})}K.appendChild(t);c(d.DEBUG,"present_feedback_widget, Appended the iframe");x(window,"message",function(z){var N={};try{N=JSON.parse(z.data),c(d.DEBUG,"present_feedback_widget, Parsed response message "+N)}catch(tb){c(d.ERROR,"present_feedback_widget, Error while parsing message body "+tb)}N.close?(document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="none",document.getElementById("csbg").style.display=
|
|
126
|
+
"none"):c(d.DEBUG,"present_feedback_widget, Closing signal not sent yet")});if("survey"===a.type){var L=!1;switch(a.showPolicy){case "afterPageLoad":"complete"===document.readyState?L||(L=!0,k(a)):x(document,"readystatechange",function(z){"complete"!==z.target.readyState||L||(L=!0,k(a))});break;case "afterConstantDelay":setTimeout(function(){L||(L=!0,k(a))},1E4);break;case "onAbandon":"complete"===document.readyState?x(document,"mouseleave",function(){L||(L=!0,k(a))}):x(document,"readystatechange",
|
|
127
|
+
function(z){"complete"===z.target.readyState&&x(document,"mouseleave",function(){L||(L=!0,k(a))})});break;case "onScrollHalfwayDown":x(window,"scroll",function(){if(!L){var z=Math.max(window.scrollY,document.body.scrollTop,document.documentElement.scrollTop),N=Ba();z>=N/2&&(L=!0,k(a))}});break;default:L||(L=!0,k(a))}}else if("nps"===a.type)document.getElementById("countly-"+q+"-wrapper-"+a._id).style.display="block",document.getElementById("csbg").style.display="block";else if("rating"===a.type){var Pa=
|
|
128
|
+
!1;"complete"===document.readyState?Pa||(Pa=!0,l(a)):x(document,"readystatechange",function(z){"complete"!==z.target.readyState||Pa||(Pa=!0,l(a))})}}catch(z){c(d.ERROR,"present_feedback_widget, Something went wrong while presenting the widget: "+z)}};this.recordError=function(a,b,e){c(d.INFO,"recordError, Recording error");if(this.check_consent("crashes")&&a){e=e||Xa;var k="";"object"===typeof a?"undefined"!==typeof a.stack?k=a.stack:("undefined"!==typeof a.name&&(k+=a.name+":"),"undefined"!==typeof a.message&&
|
|
129
|
+
(k+=a.message+"\n"),"undefined"!==typeof a.fileName&&(k+="in "+a.fileName+"\n"),"undefined"!==typeof a.lineNumber&&(k+="on "+a.lineNumber),"undefined"!==typeof a.columnNumber&&(k+=":"+a.columnNumber)):k=a+"";if(k.length>g.maxStackTraceLineLength*g.maxStackTraceLinesPerThread){c(d.DEBUG,"record_error, Error stack is too long will be truncated");a=k.split("\n");a.length>g.maxStackTraceLinesPerThread&&(a=a.splice(0,g.maxStackTraceLinesPerThread));k=0;for(var l=a.length;k<l;k++)a[k].length>g.maxStackTraceLineLength&&
|
|
130
|
+
(a[k]=a[k].substring(0,g.maxStackTraceLineLength));k=a.join("\n")}b=!!b;a=Da();k={_resolution:a._resolution,_error:k,_app_version:a._app_version,_run:B()-qb,_not_os_specific:!0,_javascript:!0};if(l=navigator.battery||navigator.webkitBattery||navigator.mozBattery||navigator.msBattery)k._bat=Math.floor(100*l.level);"undefined"!==typeof navigator.onLine&&(k._online=!!navigator.onLine);k._background=!document.hasFocus();0<ha.length&&(k._logs=ha.join("\n"));ha=[];k._nonfatal=b;k._view=this.getViewName();
|
|
131
|
+
"undefined"!==typeof e&&(e=U(e,g.maxKeyLength,g.maxValueSize,g.maxSegmentationValues,"record_error",c),k._custom=e);try{var f=document.createElement("canvas").getContext("experimental-webgl");k._opengl=f.getParameter(f.VERSION)}catch(m){c(d.ERROR,"Could not get the experimental-webgl context: "+m)}b={};b.crash=JSON.stringify(k);b.metrics=JSON.stringify({_ua:a._ua});F(b)}};this.onStorageChange=function(a,b){c(d.INFO,"onStorageChange, Applying storage changes");switch(a){case "cly_queue":E=g.deserialize(b||
|
|
132
|
+
"[]");break;case "cly_event":G=g.deserialize(b||"[]");break;case "cly_remote_configs":M=g.deserialize(b||"{}");break;case "cly_ignore":g.ignore_visitor=g.deserialize(b);break;case "cly_id":g.device_id=g.deserialize(b);break;case "cly_id_type":D=g.deserialize(b)}};this._internals={store:v,getDocWidth:Ta,getDocHeight:Ba,getViewportHeight:eb,get_page_coord:Sa,get_event_target:Oa,add_event:x,createNewObjectFromProperties:oa,truncateObject:U,truncateSingleValue:w,stripTrailingSlash:ka,prepareParams:bb,
|
|
133
|
+
sendXmlHttpRequest:aa,isResponseValid:mb,getInternalDeviceIdType:function(){return D},getMsTimestamp:Qa,getTimestamp:B,isResponseValidBroad:lb,log:c,getMetrics:Da,generateUUID:ab,sendEventsForced:J,isUUID:function(a){return/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-4[0-9a-fA-F]{3}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/.test(a)},getId:Va,heartBeat:Ga,toRequestQueue:F,reportViewDuration:Z,loadJS:gb,loadCSS:Ca,getLastView:function(){return Q},setToken:ob,getToken:function(){var a=y("cly_token");S("cly_token");return a},
|
|
134
|
+
showLoader:hb,hideLoader:ib,setValueInStorage:v,getValueFromStorage:y,removeValueFromStorage:S,add_cly_events:p,processScrollView:Wa,processScroll:nb,currentUserAgentString:qa,userAgentDeviceDetection:cb,userAgentSearchBotDetection:db,getRequestQueue:function(){return E},getEventQueue:function(){return G},clearQueue:function(){E=[];v("cly_queue",[]);G=[];v("cly_event",[])}};this.initialize()};n.init=function(h){h=h||{};var p=h.app_key||n.app_key;if(!n.i||!n.i[p]){h=new n.CountlyClass(h);if(!n.i){n.i=
|
|
135
|
+
{};for(var u in h)n[u]=h[u]}n.i[p]=h}return n.i[p]};var Aa=0,x=function(h,p,u){"undefined"!==typeof h.addEventListener?h.addEventListener(p,u,!1):h.attachEvent("on"+p,u)},Oa=function(h){return h?"undefined"!==typeof h.target?h.target:h.srcElement:window.event.srcElement};window.addEventListener("storage",function(h){var p=(h.key+"").split("/"),u=p.pop();p=p.pop();if(n.i&&n.i[p])n.i[p].onStorageChange(u,h.newValue)});n.serialize=function(h){"object"===typeof h&&(h=JSON.stringify(h));return h};n.deserialize=
|
|
136
|
+
function(h){try{h=JSON.parse(h)}catch(p){}return h};n.getViewName=function(){return window.location.pathname};n.getViewUrl=function(){return window.location.pathname};n.getSearchQuery=function(){return window.location.search};n.DeviceIdType={DEVELOPER_SUPPLIED:0,SDK_GENERATED:1,TEMPORARY_ID:2};return n}});
|
package/package.json
CHANGED
|
Binary file
|