@capillarytech/cap-ui-utils 1.2.2 → 1.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.
- package/GA/index.js +22 -7
- package/GA/utils/tracker.js +1 -1
- package/package.json +1 -1
package/GA/index.js
CHANGED
|
@@ -16,11 +16,8 @@ const _initialize = (GAConfigs) => {
|
|
|
16
16
|
if(GAConfigs.accessKey) {
|
|
17
17
|
ReactGA.initialize(GAConfigs.accessKey,{debug: true,});
|
|
18
18
|
}
|
|
19
|
-
if(GAConfigs.
|
|
20
|
-
|
|
21
|
-
window.addEventListener('error', (e) =>{
|
|
22
|
-
tracker.trackException(`UI Error ${e.message}`);
|
|
23
|
-
});
|
|
19
|
+
if(GAConfigs.trackUIError){
|
|
20
|
+
errorTracks();
|
|
24
21
|
}
|
|
25
22
|
eventsAfterInitialize();
|
|
26
23
|
log("Cap GA initialized");
|
|
@@ -34,13 +31,12 @@ const initialize = (GAConfigs) =>{
|
|
|
34
31
|
return;
|
|
35
32
|
}
|
|
36
33
|
for ( const config in GAConfigs) {
|
|
37
|
-
if (
|
|
34
|
+
if (!GAConfigs[config]) {
|
|
38
35
|
warn("Config is empty");
|
|
39
36
|
return;
|
|
40
37
|
}
|
|
41
38
|
}
|
|
42
39
|
_initialize(GAConfigs);
|
|
43
|
-
|
|
44
40
|
return true;
|
|
45
41
|
}
|
|
46
42
|
const eventsAfterInitialize = () => {
|
|
@@ -52,6 +48,25 @@ const eventsAfterInitialize = () => {
|
|
|
52
48
|
});
|
|
53
49
|
}
|
|
54
50
|
|
|
51
|
+
const errorTracks = () => {
|
|
52
|
+
window.onerror = function (msg, url, lineNo, columnNo, error) {
|
|
53
|
+
// to avoid 2 times same error log
|
|
54
|
+
if (error.hasBeenCaught !== undefined){
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
57
|
+
error.hasBeenCaught = true
|
|
58
|
+
const message = [
|
|
59
|
+
'Message: ' + msg,
|
|
60
|
+
'URL: ' + url,
|
|
61
|
+
'Column: ' + columnNo,
|
|
62
|
+
'Error object: ' + JSON.stringify(error)
|
|
63
|
+
].join(' - ');
|
|
64
|
+
tracker.trackException({
|
|
65
|
+
description: message,
|
|
66
|
+
fatal: true,
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
55
70
|
|
|
56
71
|
// ttiPolyfill.getFirstConsistentlyInteractive().then(tti => {
|
|
57
72
|
// console.log('performance tti', tti);
|
package/GA/utils/tracker.js
CHANGED