@capillarytech/cap-ui-utils 1.3.8 → 1.4.0

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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capillarytech/cap-ui-utils",
3
- "version": "1.3.8",
3
+ "version": "1.4.0",
4
4
  "description": "Utility functions shared accross all the modules",
5
5
  "main": "index.js",
6
6
  "scripts": {