@mjhls/mjh-framework 1.0.805 → 1.0.806

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.805
2
+ # mjh-framework v. 1.0.806
3
3
 
4
4
 
5
5
  [![NPM](https://img.shields.io/npm/v/mjh-framework.svg)](https://www.npmjs.com/package/mjh-framework) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
@@ -3,6 +3,7 @@
3
3
  var asyncToGenerator = require('./asyncToGenerator-58c289d9.js');
4
4
  var toConsumableArray = require('./toConsumableArray-ddb70795.js');
5
5
  var React = require('react');
6
+ var ReactGA = require('react-ga');
6
7
  var index = require('./index-0e4427c8.js');
7
8
  var main = require('./main-f1c77adb.js');
8
9
  require('./_commonjsHelpers-06173234.js');
@@ -17,6 +18,7 @@ require('prop-types');
17
18
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
19
 
19
20
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
21
+ var ReactGA__default = /*#__PURE__*/_interopDefaultLegacy(ReactGA);
20
22
 
21
23
  var _this = undefined;
22
24
 
@@ -34,6 +36,25 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
34
36
  _ref$refreshInterval = _ref.refreshInterval,
35
37
  refreshInterval = _ref$refreshInterval === undefined ? 60 : _ref$refreshInterval;
36
38
 
39
+
40
+ var logEvent = function logEvent(action, category, GA_TRACKING_ID) {
41
+ if (!GA_TRACKING_ID && typeof window !== 'undefined') GA_TRACKING_ID = sessionStorage.getItem('GA_TRACKING_ID');
42
+
43
+ if (GA_TRACKING_ID && GA_TRACKING_ID.includes(',')) {
44
+ ReactGA__default['default'].event({
45
+ category: category,
46
+ action: action
47
+
48
+ }, GA_TRACKING_ID.split(',').map(function (id, index) {
49
+ return 'ga_id_' + ++index;
50
+ }));
51
+ } else {
52
+ ReactGA__default['default'].event({
53
+ category: category,
54
+ action: action
55
+ });
56
+ }
57
+ };
37
58
  React.useEffect(function () {
38
59
  // Refresh ADs after every one minute if user didn't scroll.
39
60
  // refreshInterval accepts time in seconds and default is 60 seconds
@@ -123,8 +144,9 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
123
144
 
124
145
  case 12:
125
146
  index.lib_3.refresh.apply(index.lib_3, toConsumableArray._toConsumableArray(ads));
147
+ logEvent('AD Refresh', 'AD');
126
148
 
127
- case 13:
149
+ case 14:
128
150
  case 'end':
129
151
  return _context2.stop();
130
152
  }
package/dist/cjs/index.js CHANGED
@@ -171,6 +171,7 @@ require('./NavFooter-3dcd99a8.js');
171
171
  require('./index.esm-2bb721c8.js');
172
172
  require('./SocialSearchComponent-948138c7.js');
173
173
  require('react-bootstrap/FormControl');
174
+ require('react-ga');
174
175
  require('react-bootstrap/Carousel');
175
176
  require('react-bootstrap/Breadcrumb');
176
177
  require('./keys-7f2c2108.js');
@@ -1,6 +1,7 @@
1
1
  import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7f8f9219.js';
2
2
  import { _ as _toConsumableArray } from './toConsumableArray-6d9a4616.js';
3
3
  import React__default, { useEffect } from 'react';
4
+ import ReactGA from 'react-ga';
4
5
  import { l as lib_3, b as lib_1 } from './index-5cc7b406.js';
5
6
  import { e as main_24, m as main_43 } from './main-d4165069.js';
6
7
  import './_commonjsHelpers-0c4b6f40.js';
@@ -28,6 +29,25 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
28
29
  _ref$refreshInterval = _ref.refreshInterval,
29
30
  refreshInterval = _ref$refreshInterval === undefined ? 60 : _ref$refreshInterval;
30
31
 
32
+
33
+ var logEvent = function logEvent(action, category, GA_TRACKING_ID) {
34
+ if (!GA_TRACKING_ID && typeof window !== 'undefined') GA_TRACKING_ID = sessionStorage.getItem('GA_TRACKING_ID');
35
+
36
+ if (GA_TRACKING_ID && GA_TRACKING_ID.includes(',')) {
37
+ ReactGA.event({
38
+ category: category,
39
+ action: action
40
+
41
+ }, GA_TRACKING_ID.split(',').map(function (id, index) {
42
+ return 'ga_id_' + ++index;
43
+ }));
44
+ } else {
45
+ ReactGA.event({
46
+ category: category,
47
+ action: action
48
+ });
49
+ }
50
+ };
31
51
  useEffect(function () {
32
52
  // Refresh ADs after every one minute if user didn't scroll.
33
53
  // refreshInterval accepts time in seconds and default is 60 seconds
@@ -117,8 +137,9 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
117
137
 
118
138
  case 12:
119
139
  lib_3.refresh.apply(lib_3, _toConsumableArray(ads));
140
+ logEvent('AD Refresh', 'AD');
120
141
 
121
- case 13:
142
+ case 14:
122
143
  case 'end':
123
144
  return _context2.stop();
124
145
  }
package/dist/esm/index.js CHANGED
@@ -167,6 +167,7 @@ import './NavFooter-e27bd93b.js';
167
167
  import './index.esm-37268dca.js';
168
168
  import './SocialSearchComponent-db963c3e.js';
169
169
  import 'react-bootstrap/FormControl';
170
+ import 'react-ga';
170
171
  import 'react-bootstrap/Carousel';
171
172
  import 'react-bootstrap/Breadcrumb';
172
173
  import './keys-7a3adabf.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.805",
3
+ "version": "1.0.806",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",