@capillarytech/cap-ui-utils 1.3.8 → 1.4.1
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 +2 -2
- package/GA/utils/tracker.js +15 -2
- package/auth/hasAccess.js +1 -1
- package/auth/hasFeatureAccess.js +1 -1
- package/auth/hasRole.js +1 -1
- package/package.json +1 -1
package/GA/index.js
CHANGED
|
@@ -10,12 +10,12 @@ import warn from '../utils/console/warn';
|
|
|
10
10
|
import log from '../utils/console/log';
|
|
11
11
|
|
|
12
12
|
const _initialize = (GAConfigs) => {
|
|
13
|
-
const { accessKey, trackUIError, trackLoadPerformance } = GAConfigs || {}
|
|
13
|
+
const { accessKey, trackUIError, trackLoadPerformance, gaOptions = {} } = GAConfigs || {};
|
|
14
14
|
if (!accessKey) {
|
|
15
15
|
warn("Cannot initialize GA without accessKey");
|
|
16
16
|
return;
|
|
17
17
|
} else {
|
|
18
|
-
ReactGA.initialize(accessKey,{debug: true,});
|
|
18
|
+
ReactGA.initialize(accessKey,{debug: true, gaOptions});
|
|
19
19
|
}
|
|
20
20
|
if(trackUIError){
|
|
21
21
|
errorTracks();
|
package/GA/utils/tracker.js
CHANGED
|
@@ -8,16 +8,29 @@ const trackTiming = () => {}
|
|
|
8
8
|
|
|
9
9
|
const trackPageView = () => {}
|
|
10
10
|
|
|
11
|
-
const trackException = ({description, fatal = true}) => {
|
|
11
|
+
const trackException = ({description, fatal = true, apiError = false, statusCode}) => {
|
|
12
|
+
if(apiError) {
|
|
13
|
+
trackAPIError({statusCode});
|
|
14
|
+
}
|
|
12
15
|
ReactGA.exception({
|
|
13
16
|
description,
|
|
14
17
|
fatal,
|
|
15
18
|
});
|
|
16
19
|
}
|
|
17
20
|
|
|
21
|
+
const trackAPIError = ({statusCode}) => {
|
|
22
|
+
if(window.dataLayer) {
|
|
23
|
+
window.dataLayer.push({
|
|
24
|
+
apiError: {statusCode},
|
|
25
|
+
event: 'apiError'
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
export default {
|
|
19
31
|
trackException,
|
|
20
32
|
trackPageView,
|
|
21
33
|
trackTiming,
|
|
22
|
-
trackEvent
|
|
34
|
+
trackEvent,
|
|
35
|
+
trackAPIError
|
|
23
36
|
}
|
package/auth/hasAccess.js
CHANGED
package/auth/hasFeatureAccess.js
CHANGED
package/auth/hasRole.js
CHANGED