@codecademy/tracking 1.0.14-alpha.ffbb26850a.0 → 1.0.14
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/dist/events/track.js +2 -12
- package/package.json +2 -5
package/dist/events/track.js
CHANGED
|
@@ -10,7 +10,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import axios from 'axios';
|
|
14
13
|
import { getClientType } from '../integrations/device';
|
|
15
14
|
var browserSupportsKeepalive = function browserSupportsKeepalive() {
|
|
16
15
|
return 'keepalive' in window.Request.prototype;
|
|
@@ -48,10 +47,6 @@ export var createTracker = function createTracker(_ref) {
|
|
|
48
47
|
keepalive: true
|
|
49
48
|
}));
|
|
50
49
|
};
|
|
51
|
-
var serverSideBeacon = function serverSideBeacon(endpoint, data) {
|
|
52
|
-
var uri = new URL(endpoint, apiBaseUrl).toString();
|
|
53
|
-
axios.post(uri, data);
|
|
54
|
-
};
|
|
55
50
|
var event = function event(category, _event, userData) {
|
|
56
51
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
57
52
|
// support server-side-only as well as client-side events
|
|
@@ -73,8 +68,9 @@ export var createTracker = function createTracker(_ref) {
|
|
|
73
68
|
});
|
|
74
69
|
console.groupEnd();
|
|
75
70
|
}
|
|
71
|
+
|
|
72
|
+
// This allows the UTM query params to get registered in the user session.
|
|
76
73
|
if (typeof window !== 'undefined') {
|
|
77
|
-
// This allows the UTM query params to get registered in the user session.
|
|
78
74
|
var queryParams = window.location.search;
|
|
79
75
|
beacon("/analytics/".concat(category).concat(queryParams), {
|
|
80
76
|
category: category,
|
|
@@ -82,12 +78,6 @@ export var createTracker = function createTracker(_ref) {
|
|
|
82
78
|
properties: JSON.stringify(properties),
|
|
83
79
|
gdpr_safe: "".concat(options.gdprSafe)
|
|
84
80
|
});
|
|
85
|
-
} else {
|
|
86
|
-
serverSideBeacon("/analytics/".concat(category), {
|
|
87
|
-
category: category,
|
|
88
|
-
event: _event,
|
|
89
|
-
properties: JSON.stringify(properties)
|
|
90
|
-
});
|
|
91
81
|
}
|
|
92
82
|
};
|
|
93
83
|
return {
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/tracking",
|
|
3
3
|
"description": "Tracking library for Codecademy",
|
|
4
|
-
"version": "1.0.14
|
|
4
|
+
"version": "1.0.14",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@babel/runtime": "^7.12.1"
|
|
8
|
-
},
|
|
9
6
|
"files": [
|
|
10
7
|
"dist/**"
|
|
11
8
|
],
|
|
@@ -16,5 +13,5 @@
|
|
|
16
13
|
"access": "public"
|
|
17
14
|
},
|
|
18
15
|
"repository": "git@github.com:codecademy-engineering/mono.git",
|
|
19
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "357e88ff4a37fece54005422e94e591bc176df77"
|
|
20
17
|
}
|