@codecademy/tracking 1.0.25 → 1.0.26-alpha.6127d23930.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.
- package/dist/events/track.js +4 -3
- package/package.json +2 -2
package/dist/events/track.js
CHANGED
|
@@ -15,7 +15,8 @@ export const createTracker = _ref => {
|
|
|
15
15
|
let apiBaseUrl = _ref.apiBaseUrl,
|
|
16
16
|
verbose = _ref.verbose;
|
|
17
17
|
const beacon = (endpoint, data) => {
|
|
18
|
-
const uri =
|
|
18
|
+
const uri = apiBaseUrl + endpoint;
|
|
19
|
+
if (!URL.canParse(uri)) throw TypeError('invalid tracking URI');
|
|
19
20
|
const form = new FormData();
|
|
20
21
|
for (const _ref2 of Object.entries(data)) {
|
|
21
22
|
var _ref3 = _slicedToArray(_ref2, 2);
|
|
@@ -81,14 +82,14 @@ export const createTracker = _ref => {
|
|
|
81
82
|
if (typeof window !== 'undefined') {
|
|
82
83
|
// This allows the UTM query params to get registered in the user session.
|
|
83
84
|
const queryParams = window.location.search;
|
|
84
|
-
beacon("/
|
|
85
|
+
beacon("/".concat(category).concat(queryParams), {
|
|
85
86
|
category,
|
|
86
87
|
event,
|
|
87
88
|
properties: JSON.stringify(properties),
|
|
88
89
|
gdpr_safe: "".concat(options.gdprSafe)
|
|
89
90
|
});
|
|
90
91
|
} else {
|
|
91
|
-
serverSideBeacon("/
|
|
92
|
+
serverSideBeacon("/".concat(category), {
|
|
92
93
|
category,
|
|
93
94
|
event,
|
|
94
95
|
properties: JSON.stringify(properties)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/tracking",
|
|
3
3
|
"description": "Tracking library for Codecademy",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.26-alpha.6127d23930.0",
|
|
5
5
|
"author": "Codecademy Engineering <dev@codecademy.com>",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist/**"
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"repository": "git@github.com:codecademy-engineering/mono.git",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "45a580369e522533e9f274575cfe0cd2278676bf"
|
|
17
17
|
}
|