countly-sdk-web 22.2.2 → 22.2.3

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.
Files changed (91) hide show
  1. package/.eslintignore +17 -17
  2. package/.eslintrc.js +215 -215
  3. package/.github/dependabot.yml +20 -20
  4. package/.github/workflows/codeql-analysis.yml +71 -71
  5. package/.github/workflows/documentation.yml +24 -0
  6. package/.github/workflows/node.js.yml +25 -41
  7. package/CHANGELOG.md +241 -237
  8. package/LICENSE +19 -19
  9. package/README.md +86 -122
  10. package/SECURITY.md +3 -3
  11. package/bower.json +29 -29
  12. package/cypress/.eslintrc.js +22 -22
  13. package/cypress/fixtures/base.html +8 -0
  14. package/cypress/fixtures/scroll_test.html +60 -0
  15. package/cypress/fixtures/scroll_test_2.html +48 -0
  16. package/cypress/fixtures/scroll_test_3.html +72 -0
  17. package/cypress/fixtures/session_test_auto.html +51 -0
  18. package/cypress/fixtures/session_test_manual_1.html +58 -0
  19. package/cypress/fixtures/session_test_manual_2.html +54 -0
  20. package/cypress/fixtures/user_agent.html +20 -0
  21. package/cypress/integration/consents.js +165 -165
  22. package/cypress/integration/device_id.js +1085 -830
  23. package/cypress/integration/events.js +65 -65
  24. package/cypress/integration/heatmaps.js +52 -0
  25. package/cypress/integration/internal_limits.js +153 -153
  26. package/cypress/integration/reponse_validation.js +170 -170
  27. package/cypress/integration/sessions.js +196 -60
  28. package/cypress/integration/user_agent.js +63 -0
  29. package/cypress/integration/user_details.js +40 -40
  30. package/cypress/integration/utm.js +236 -236
  31. package/cypress/integration/views.js +62 -62
  32. package/cypress/plugins/index.js +22 -22
  33. package/cypress/support/commands.js +322 -298
  34. package/cypress/support/helper.js +59 -59
  35. package/cypress/support/index.js +2 -2
  36. package/cypress/support/integration_helper.js +17 -0
  37. package/cypress.json +3 -1
  38. package/examples/example_apm.html +51 -51
  39. package/examples/example_fb.html +50 -50
  40. package/examples/example_formdata.html +47 -47
  41. package/examples/example_ga_adapter.html +173 -173
  42. package/examples/example_gdpr.html +82 -82
  43. package/examples/example_internal_limits.html +184 -184
  44. package/examples/example_multiple_instances.html +52 -52
  45. package/examples/example_rating_widgets.html +80 -80
  46. package/examples/example_remote_config.html +38 -38
  47. package/examples/example_sync.html +36 -36
  48. package/examples/examples_feedback_widgets.html +81 -81
  49. package/examples/mpa/boomerang/boomerang-1.0.0.js +22871 -22871
  50. package/examples/mpa/boomerang/countly_boomerang.js +138 -138
  51. package/examples/mpa/index.html +816 -816
  52. package/examples/react/README.md +35 -35
  53. package/examples/react/package.json +37 -37
  54. package/examples/react/public/index.html +19 -19
  55. package/examples/react/public/manifest.json +25 -25
  56. package/examples/react/public/robots.txt +3 -3
  57. package/examples/react/src/App-WithEffect.js +33 -33
  58. package/examples/react/src/App-WithRouter.js +46 -46
  59. package/examples/react/src/App.test.js +9 -9
  60. package/examples/react/src/Components/Contact.js +28 -28
  61. package/examples/react/src/Components/Header.js +88 -88
  62. package/examples/react/src/Components/Home.js +23 -23
  63. package/examples/react/src/Components/Users.js +43 -43
  64. package/examples/react/src/Components/styles.css +25 -25
  65. package/examples/react/src/ErrorBoundary.js +28 -28
  66. package/examples/react/src/Location-WithEffect.js +27 -27
  67. package/examples/react/src/Location-WithRouter.js +23 -23
  68. package/examples/react/src/index.css +5 -5
  69. package/examples/react/src/index.js +68 -68
  70. package/examples/react/src/serviceWorker.js +141 -141
  71. package/examples/react/src/setupTests.js +5 -5
  72. package/examples/symbolication/.babelrc +11 -11
  73. package/examples/symbolication/.editorconfig +8 -8
  74. package/examples/symbolication/.yo-rc.json +53 -53
  75. package/examples/symbolication/README.md +33 -33
  76. package/examples/symbolication/package.json +22 -22
  77. package/examples/symbolication/src/index.js +47 -47
  78. package/examples/symbolication/static/index.html +21 -21
  79. package/examples/symbolication/webpack.config.js +27 -27
  80. package/generateDocs.sh +80 -79
  81. package/inch.json +6 -6
  82. package/jsdoc_conf.json +4 -2
  83. package/lib/countly.js +4625 -4416
  84. package/lib/countly.min.js +126 -117
  85. package/package.json +57 -57
  86. package/plugin/boomerang/boomerang.min.js +10 -10
  87. package/plugin/boomerang/countly_boomerang.js +150 -150
  88. package/plugin/ga_adapter/doc.md +73 -73
  89. package/plugin/ga_adapter/ga_adapter.js +451 -451
  90. package/webpack.config.js +12 -12
  91. package/countly-sdk-web-22.2.2.tgz +0 -0
@@ -1,24 +1,24 @@
1
- import React from 'react';
2
-
3
- import Users from './Users';
4
- import countlyImage from './countly.jpg';
5
-
6
- function Home() {
7
- let userIndex = localStorage.getItem("clydemo-user");
8
- let user = {};
9
-
10
- if (userIndex !== undefined && userIndex !== null) {
11
- user = Users[userIndex] || {};
12
- }
13
-
14
- return (
15
- <div>
16
- <center>
17
- <img src={countlyImage} alt="Home"></img>
18
- <h1>Welcome {user.name}</h1>
19
- </center>
20
- </div>
21
- );
22
- }
23
-
1
+ import React from 'react';
2
+
3
+ import Users from './Users';
4
+ import countlyImage from './countly.jpg';
5
+
6
+ function Home() {
7
+ let userIndex = localStorage.getItem("clydemo-user");
8
+ let user = {};
9
+
10
+ if (userIndex !== undefined && userIndex !== null) {
11
+ user = Users[userIndex] || {};
12
+ }
13
+
14
+ return (
15
+ <div>
16
+ <center>
17
+ <img src={countlyImage} alt="Home"></img>
18
+ <h1>Welcome {user.name}</h1>
19
+ </center>
20
+ </div>
21
+ );
22
+ }
23
+
24
24
  export default Home;
@@ -1,44 +1,44 @@
1
- const Users = [
2
- {
3
- "device_id": "prikshit",
4
- "name": "Prikshit",
5
- "username": "prikshit",
6
- "email": "prikshit@cly.com",
7
- "organization": "Google",
8
- "phone": "+919882201994",
9
- "gender": "M",
10
- "byear": "1994"
11
- },
12
- {
13
- "device_id": "alex",
14
- "name": "Alex",
15
- "username": "alex",
16
- "email": "alex@cly.com",
17
- "organization": "Amazom",
18
- "phone": "+919882202010",
19
- "gender": "M",
20
- "byear": "2010"
21
- },
22
- {
23
- "device_id": "hannah",
24
- "name": "Hannah",
25
- "username": "hannah",
26
- "email": "hannah@cly.com",
27
- "organization": "Facebook",
28
- "phone": "+919882202000",
29
- "gender": "F",
30
- "byear": "2000"
31
- },
32
- {
33
- "device_id": "jarvis",
34
- "name": "Jarvis",
35
- "username": "jarvis",
36
- "email": "jarvis@cly.com",
37
- "organization": "Tony Stark corp",
38
- "phone": "+919882202013",
39
- "gender": "F",
40
- "byear": "2013"
41
- },
42
- ];
43
-
1
+ const Users = [
2
+ {
3
+ "device_id": "prikshit",
4
+ "name": "Prikshit",
5
+ "username": "prikshit",
6
+ "email": "prikshit@cly.com",
7
+ "organization": "Google",
8
+ "phone": "+919882201994",
9
+ "gender": "M",
10
+ "byear": "1994"
11
+ },
12
+ {
13
+ "device_id": "alex",
14
+ "name": "Alex",
15
+ "username": "alex",
16
+ "email": "alex@cly.com",
17
+ "organization": "Amazom",
18
+ "phone": "+919882202010",
19
+ "gender": "M",
20
+ "byear": "2010"
21
+ },
22
+ {
23
+ "device_id": "hannah",
24
+ "name": "Hannah",
25
+ "username": "hannah",
26
+ "email": "hannah@cly.com",
27
+ "organization": "Facebook",
28
+ "phone": "+919882202000",
29
+ "gender": "F",
30
+ "byear": "2000"
31
+ },
32
+ {
33
+ "device_id": "jarvis",
34
+ "name": "Jarvis",
35
+ "username": "jarvis",
36
+ "email": "jarvis@cly.com",
37
+ "organization": "Tony Stark corp",
38
+ "phone": "+919882202013",
39
+ "gender": "F",
40
+ "byear": "2013"
41
+ },
42
+ ];
43
+
44
44
  export default Users;
@@ -1,26 +1,26 @@
1
- .link {
2
- text-decoration: none;
3
- padding: 20px;
4
- color: #000;
5
- }
6
-
7
- .contact {
8
- text-align: center;
9
- }
10
-
11
- .header {
12
- width: 100%;
13
- height: 100px;
14
- display: flex;
15
- justify-content: space-between;
16
- align-items: center;
17
- background-color: #cff96b;
18
- }
19
-
20
- .email-us {
21
- padding: 20px;
22
- font-size: 20px;
23
- background-color: #cff96b;
24
- border: none;
25
- border-radius: 2px;
1
+ .link {
2
+ text-decoration: none;
3
+ padding: 20px;
4
+ color: #000;
5
+ }
6
+
7
+ .contact {
8
+ text-align: center;
9
+ }
10
+
11
+ .header {
12
+ width: 100%;
13
+ height: 100px;
14
+ display: flex;
15
+ justify-content: space-between;
16
+ align-items: center;
17
+ background-color: #cff96b;
18
+ }
19
+
20
+ .email-us {
21
+ padding: 20px;
22
+ font-size: 20px;
23
+ background-color: #cff96b;
24
+ border: none;
25
+ border-radius: 2px;
26
26
  }
@@ -1,28 +1,28 @@
1
- import React from "react";
2
- import Countly from "countly-sdk-web";
3
-
4
- // Error boundaries only apply to errors that happen during rendering.
5
- // So errors originating anywhere else will not trigger this mechanism.
6
- // This includes errors in event handlers, and errors in async calls (e.g. setTimeout(...) and similar).
7
-
8
- // Production and development builds of React slightly differ in the way componentDidCatch() handles errors.
9
-
10
- // On development, the errors will bubble up to window, this means that any window.onerror or
11
- // window.addEventListener('error', callback) will intercept the errors that have been caught by componentDidCatch().
12
-
13
- // On production, instead, the errors will not bubble up, which means any ancestor error handler will
14
- // only receive errors not explicitly caught by componentDidCatch().
15
-
16
- class ErrorBoundary extends React.Component {
17
- componentDidCatch(error, errorInfo) {
18
- //You can provide your own segments here too.
19
- let segments = {};
20
- Countly.q.push(["log_error", error, segments]);
21
- }
22
-
23
- render() {
24
- return this.props.children;
25
- }
26
- }
27
-
28
- export default ErrorBoundary;
1
+ import React from "react";
2
+ import Countly from "countly-sdk-web";
3
+
4
+ // Error boundaries only apply to errors that happen during rendering.
5
+ // So errors originating anywhere else will not trigger this mechanism.
6
+ // This includes errors in event handlers, and errors in async calls (e.g. setTimeout(...) and similar).
7
+
8
+ // Production and development builds of React slightly differ in the way componentDidCatch() handles errors.
9
+
10
+ // On development, the errors will bubble up to window, this means that any window.onerror or
11
+ // window.addEventListener('error', callback) will intercept the errors that have been caught by componentDidCatch().
12
+
13
+ // On production, instead, the errors will not bubble up, which means any ancestor error handler will
14
+ // only receive errors not explicitly caught by componentDidCatch().
15
+
16
+ class ErrorBoundary extends React.Component {
17
+ componentDidCatch(error, errorInfo) {
18
+ //You can provide your own segments here too.
19
+ let segments = {};
20
+ Countly.q.push(["log_error", error, segments]);
21
+ }
22
+
23
+ render() {
24
+ return this.props.children;
25
+ }
26
+ }
27
+
28
+ export default ErrorBoundary;
@@ -1,27 +1,27 @@
1
- import React from 'react';
2
- import {
3
- useLocation
4
- } from "react-router-dom";
5
-
6
- import Countly from 'countly-sdk-web';
7
-
8
- const Location = (props) => {
9
- const location = useLocation();
10
-
11
- React.useEffect(() => {
12
- //You can also check for page redirect logic or going back/forward from the browser logic here
13
- //Check if pathname is not changing dont track the view
14
- //So that you dont end up tracking the same view again and again
15
- Countly.q.push(['track_pageview', location.pathname]);
16
- // Initialize rating widget popup by current page/pathname
17
- Countly.q.push(['initializeRatingWidgets']);
18
- }, [location]);
19
-
20
- return (
21
- <React.Fragment>
22
- {props.children}
23
- </React.Fragment>
24
- );
25
- }
26
-
27
- export default Location;
1
+ import React from 'react';
2
+ import {
3
+ useLocation
4
+ } from "react-router-dom";
5
+
6
+ import Countly from 'countly-sdk-web';
7
+
8
+ const Location = (props) => {
9
+ const location = useLocation();
10
+
11
+ React.useEffect(() => {
12
+ //You can also check for page redirect logic or going back/forward from the browser logic here
13
+ //Check if pathname is not changing dont track the view
14
+ //So that you dont end up tracking the same view again and again
15
+ Countly.q.push(['track_pageview', location.pathname]);
16
+ // Initialize rating widget popup by current page/pathname
17
+ Countly.q.push(['initializeRatingWidgets']);
18
+ }, [location]);
19
+
20
+ return (
21
+ <React.Fragment>
22
+ {props.children}
23
+ </React.Fragment>
24
+ );
25
+ }
26
+
27
+ export default Location;
@@ -1,24 +1,24 @@
1
- import React from 'react';
2
- import {
3
- withRouter
4
- } from "react-router-dom";
5
-
6
- import Countly from 'countly-sdk-web';
7
-
8
- class Location extends React.Component {
9
- componentDidUpdate(prevProps) {
10
- if (this.props.location.pathname !== prevProps.location.pathname) {
11
- Countly.q.push(["track_pageview", this.props.location.pathname]);
12
- }
13
- }
14
-
15
- render () {
16
- return (
17
- <React.Fragment>
18
- {this.props.children}
19
- </React.Fragment>
20
- )
21
- }
22
- }
23
-
1
+ import React from 'react';
2
+ import {
3
+ withRouter
4
+ } from "react-router-dom";
5
+
6
+ import Countly from 'countly-sdk-web';
7
+
8
+ class Location extends React.Component {
9
+ componentDidUpdate(prevProps) {
10
+ if (this.props.location.pathname !== prevProps.location.pathname) {
11
+ Countly.q.push(["track_pageview", this.props.location.pathname]);
12
+ }
13
+ }
14
+
15
+ render () {
16
+ return (
17
+ <React.Fragment>
18
+ {this.props.children}
19
+ </React.Fragment>
20
+ )
21
+ }
22
+ }
23
+
24
24
  export default withRouter(Location);
@@ -1,6 +1,6 @@
1
- body {
2
- margin: 0;
3
- font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
4
- -webkit-font-smoothing: antialiased;
5
- -moz-osx-font-smoothing: grayscale;
1
+ body {
2
+ margin: 0;
3
+ font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
4
+ -webkit-font-smoothing: antialiased;
5
+ -moz-osx-font-smoothing: grayscale;
6
6
  }
@@ -1,68 +1,68 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import './index.css';
4
- import App from './App-WithEffect';
5
- import * as serviceWorker from './serviceWorker';
6
- import Countly from 'countly-sdk-web';
7
-
8
- //Exposing Countly to the DOM as a global variable
9
- //Usecase - Heatmaps
10
- window.Countly = Countly;
11
- Countly.init({
12
- app_key: 'YOUR_APP_KEY',
13
- url: 'YOUR_SERVER_URL',
14
- session_update: 10,
15
- use_session_cookie: true,
16
- debug: false,
17
- require_consent: true,
18
- namespace: "react-demo",
19
- inactivity_time: 1,
20
- offline_mode: false,
21
- // device_id: "cly-device-demo-id" //Set only if you want dont want to use countly generated device_id
22
- });
23
-
24
- //Since Countly is loaded and available, you can use synchronus or asynchronus calls, does not matter
25
- Countly.q.push(['group_features', {
26
- activity: ["sessions", "events", "views", "location"],
27
- interaction: ["scrolls", "clicks", "crashes"],
28
- whereabouts: ["users"]
29
- }]);
30
-
31
- if (typeof(localStorage) !== "undefined") {
32
- var consents = localStorage.getItem("consents");
33
-
34
- if(consents){
35
- Countly.q.push(['add_consent', JSON.parse(consents)]);
36
- }
37
- else{
38
- var consent = window.confirm("We are going to track you. Do you give your consent ?");
39
- consents = ["activity", "interaction", "whereabouts"];
40
- if(consent) {
41
- Countly.q.push(['add_consent', consents]);
42
- localStorage.setItem("consents", JSON.stringify(consents));
43
- }
44
- else {
45
- Countly.q.push(['remove_consent', consents]);
46
- localStorage.removeItem("consents");
47
- }
48
- }
49
- }
50
-
51
- Countly.q.push(['enableRatingWidgets', {'widgets': ['widget-id-1','widget-id-2']}]);
52
- Countly.q.push(['track_sessions']);
53
- Countly.q.push(['track_scrolls']);
54
- Countly.q.push(['track_clicks']);
55
- Countly.q.push(['track_links']);
56
- Countly.q.push(["track_errors"]);
57
-
58
- ReactDOM.render(
59
- <React.StrictMode>
60
- <App />
61
- </React.StrictMode>,
62
- document.getElementById('root')
63
- );
64
-
65
- // If you want your app to work offline and load faster, you can change
66
- // unregister() to register() below. Note this comes with some pitfalls.
67
- // Learn more about service workers: https://bit.ly/CRA-PWA
68
- serviceWorker.unregister();
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import './index.css';
4
+ import App from './App-WithEffect';
5
+ import * as serviceWorker from './serviceWorker';
6
+ import Countly from 'countly-sdk-web';
7
+
8
+ //Exposing Countly to the DOM as a global variable
9
+ //Usecase - Heatmaps
10
+ window.Countly = Countly;
11
+ Countly.init({
12
+ app_key: 'YOUR_APP_KEY',
13
+ url: 'YOUR_SERVER_URL',
14
+ session_update: 10,
15
+ use_session_cookie: true,
16
+ debug: false,
17
+ require_consent: true,
18
+ namespace: "react-demo",
19
+ inactivity_time: 1,
20
+ offline_mode: false,
21
+ // device_id: "cly-device-demo-id" //Set only if you want dont want to use countly generated device_id
22
+ });
23
+
24
+ //Since Countly is loaded and available, you can use synchronus or asynchronus calls, does not matter
25
+ Countly.q.push(['group_features', {
26
+ activity: ["sessions", "events", "views", "location"],
27
+ interaction: ["scrolls", "clicks", "crashes"],
28
+ whereabouts: ["users"]
29
+ }]);
30
+
31
+ if (typeof(localStorage) !== "undefined") {
32
+ var consents = localStorage.getItem("consents");
33
+
34
+ if(consents){
35
+ Countly.q.push(['add_consent', JSON.parse(consents)]);
36
+ }
37
+ else{
38
+ var consent = window.confirm("We are going to track you. Do you give your consent ?");
39
+ consents = ["activity", "interaction", "whereabouts"];
40
+ if(consent) {
41
+ Countly.q.push(['add_consent', consents]);
42
+ localStorage.setItem("consents", JSON.stringify(consents));
43
+ }
44
+ else {
45
+ Countly.q.push(['remove_consent', consents]);
46
+ localStorage.removeItem("consents");
47
+ }
48
+ }
49
+ }
50
+
51
+ Countly.q.push(['enableRatingWidgets', {'widgets': ['widget-id-1','widget-id-2']}]);
52
+ Countly.q.push(['track_sessions']);
53
+ Countly.q.push(['track_scrolls']);
54
+ Countly.q.push(['track_clicks']);
55
+ Countly.q.push(['track_links']);
56
+ Countly.q.push(["track_errors"]);
57
+
58
+ ReactDOM.render(
59
+ <React.StrictMode>
60
+ <App />
61
+ </React.StrictMode>,
62
+ document.getElementById('root')
63
+ );
64
+
65
+ // If you want your app to work offline and load faster, you can change
66
+ // unregister() to register() below. Note this comes with some pitfalls.
67
+ // Learn more about service workers: https://bit.ly/CRA-PWA
68
+ serviceWorker.unregister();