@codecademy/tracking 1.0.0-alpha.f35bab.0 → 1.0.1-alpha.059bcaa66.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/.eslintrc.json +33 -0
- package/CHANGELOG.md +169 -47
- package/LICENSE +1 -1
- package/babel.config.js +11 -2
- package/dist/events/track.d.ts +3 -2
- package/dist/events/track.js +34 -7
- package/dist/events/types.d.ts +33 -1
- package/dist/events/types.js +1 -0
- package/dist/events/user.js +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/integrations/conditionallyLoadAnalytics.js +6 -3
- package/dist/integrations/device.d.ts +13 -0
- package/dist/integrations/device.js +25 -0
- package/dist/integrations/fetchDestinationsForWriteKey.js +31 -19
- package/dist/integrations/getConsentDecision.d.ts +8 -0
- package/dist/integrations/getConsentDecision.js +32 -0
- package/dist/integrations/index.d.ts +5 -1
- package/dist/integrations/index.js +16 -10
- package/dist/integrations/mapDestinations.d.ts +3 -9
- package/dist/integrations/mapDestinations.js +10 -10
- package/dist/integrations/onetrust.js +9 -5
- package/dist/integrations/runSegmentSnippet.d.ts +7 -1
- package/dist/integrations/runSegmentSnippet.js +28 -50
- package/dist/integrations/types.d.ts +1 -1
- package/dist/integrations/types.js +1 -0
- package/package.json +6 -29
- package/project.json +46 -0
- package/tsconfig.json +16 -4
- package/tsconfig.spec.json +9 -0
- package/dist/events/__tests__/track.spec.d.ts +0 -1
- package/dist/events/__tests__/track.spec.js +0 -78
- package/dist/events/__tests__/track.test.d.ts +0 -1
- package/dist/events/__tests__/track.test.js +0 -78
- package/dist/events/__tests__/user.spec.d.ts +0 -1
- package/dist/events/__tests__/user.spec.js +0 -42
- package/dist/events/__tests__/user.test.d.ts +0 -1
- package/dist/events/__tests__/user.test.js +0 -42
- package/dist/integrations/__tests__/conditionallyLoadAnalytics-test.d.ts +0 -1
- package/dist/integrations/__tests__/fetchDestinationsForWriteKey-test.d.ts +0 -1
- package/dist/integrations/__tests__/mapDestinations-test.d.ts +0 -1
- package/jest.config.js +0 -7
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["../../.eslintrc.json"],
|
|
3
|
+
"ignorePatterns": ["!**/*"],
|
|
4
|
+
"overrides": [
|
|
5
|
+
{
|
|
6
|
+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
+
"rules": {}
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"files": ["*.ts", "*.tsx"],
|
|
11
|
+
"rules": {}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"files": ["*.js", "*.jsx"],
|
|
15
|
+
"rules": {}
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"rules": {
|
|
19
|
+
// These rules could be useful, but we haven"t gotten around to enabling them here
|
|
20
|
+
// See WEB-2 for general tracking.
|
|
21
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
22
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
23
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
24
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
25
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
26
|
+
"@typescript-eslint/no-unsafe-return": "off",
|
|
27
|
+
"@typescript-eslint/restrict-plus-operands": "off",
|
|
28
|
+
"@typescript-eslint/restrict-template-expressions": "off",
|
|
29
|
+
"@typescript-eslint/ts-nocheck": "off",
|
|
30
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
31
|
+
"prefer-rest-params": "off"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -3,194 +3,316 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.0.
|
|
6
|
+
## [1.0.1-alpha.059bcaa66.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@1.0.0...@codecademy/tracking@1.0.1-alpha.059bcaa66.0) (2022-11-03)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
8
9
|
|
|
9
|
-
### ⚠ BREAKING CHANGES
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.23.3](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.23.0...@codecademy/tracking@0.23.3) (2022-09-02)
|
|
15
|
+
|
|
16
|
+
### Reverts
|
|
17
|
+
|
|
18
|
+
- Revert "remove codebytes and tracking" ([c3fa53f](https://github.com/Codecademy/client-modules/commit/c3fa53f3d8a316274e19be7f779ee02cbe9013e4))
|
|
19
|
+
- Revert "remove extra eslint file" ([0696878](https://github.com/Codecademy/client-modules/commit/0696878705a56d28d49694b3114dc824e6fe1a9f))
|
|
20
|
+
|
|
21
|
+
## [0.23.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.22.0...@codecademy/tracking@0.23.0) (2022-05-24)
|
|
12
22
|
|
|
13
23
|
### Features
|
|
14
24
|
|
|
15
|
-
|
|
25
|
+
- **tracking:** :sparkles: Including field to track business seat data ([#46](https://github.com/Codecademy/client-modules/issues/46)) ([331893d](https://github.com/Codecademy/client-modules/commit/331893dd50b5bdbe861330b16744ae9f58d719be))
|
|
16
26
|
|
|
27
|
+
## [0.22.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.21.1...@codecademy/tracking@0.22.0) (2022-05-16)
|
|
17
28
|
|
|
29
|
+
### Features
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
- **tracking:** Adding misc field for click and visit events ([57ae584](https://github.com/Codecademy/client-modules/commit/57ae584d3519db2d40b9a4c021fbee309df59d75))
|
|
20
32
|
|
|
33
|
+
### [0.21.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.21.0...@codecademy/tracking@0.21.1) (2022-05-13)
|
|
21
34
|
|
|
22
35
|
### Bug Fixes
|
|
23
36
|
|
|
24
|
-
|
|
37
|
+
- **tracking:** pick content_ids ([bd8b0a6](https://github.com/Codecademy/client-modules/commit/bd8b0a63eb6d8cfda2c0471fddcb7954898fbc75))
|
|
25
38
|
|
|
39
|
+
## [0.21.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.20.0...@codecademy/tracking@0.21.0) (2022-05-13)
|
|
26
40
|
|
|
41
|
+
### Features
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
- **tracking:** add UserSharedData to user impressions ([6378ec2](https://github.com/Codecademy/client-modules/commit/6378ec2cb4f076210fa842dcfb07b43717afd1f9))
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
## [0.20.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.19.0...@codecademy/tracking@0.20.0) (2022-04-11)
|
|
31
46
|
|
|
47
|
+
### Features
|
|
32
48
|
|
|
49
|
+
- **tracking:** add experiment category to tracking types ([4fa1528](https://github.com/Codecademy/client-modules/commit/4fa1528e719df904b88953edb8a625aa06610206))
|
|
33
50
|
|
|
51
|
+
## [0.19.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.18.1...@codecademy/tracking@0.19.0) (2022-03-10)
|
|
34
52
|
|
|
53
|
+
### Features
|
|
35
54
|
|
|
36
|
-
|
|
55
|
+
- **Tracking:** add is_ugc attribute to tracking types ([2fe9c08](https://github.com/Codecademy/client-modules/commit/2fe9c083d0205e6af8dd928e9c291ebbeeeb6cbb))
|
|
37
56
|
|
|
57
|
+
### [0.18.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.18.0...@codecademy/tracking@0.18.1) (2022-02-02)
|
|
38
58
|
|
|
39
|
-
|
|
59
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
40
60
|
|
|
41
|
-
|
|
61
|
+
## [0.18.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.17.1...@codecademy/tracking@0.18.0) (2021-12-20)
|
|
42
62
|
|
|
63
|
+
### Features
|
|
43
64
|
|
|
65
|
+
- **Tracking:** add search id param to userclick data ([7150c44](https://github.com/Codecademy/client-modules/commit/7150c44d665624502cfd95ac0020130b5ab8c26a))
|
|
44
66
|
|
|
45
|
-
|
|
67
|
+
### [0.17.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.17.0...@codecademy/tracking@0.17.1) (2021-12-17)
|
|
46
68
|
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
- **tracking:** remove navigator.sendBeacon .bind and add try/catch ([b924d7e](https://github.com/Codecademy/client-modules/commit/b924d7e1ffd22d75adcaf15c9726d10f19b2924e))
|
|
72
|
+
|
|
73
|
+
## [0.17.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.16.1...@codecademy/tracking@0.17.0) (2021-11-30)
|
|
47
74
|
|
|
48
75
|
### ⚠ BREAKING CHANGES
|
|
49
76
|
|
|
50
|
-
|
|
77
|
+
- **eslint-config:** bump ESLint to 8 and typescript-eslint to 5 (#4)
|
|
51
78
|
|
|
52
79
|
### Features
|
|
53
80
|
|
|
54
|
-
|
|
81
|
+
- **eslint-config:** bump ESLint to 8 and typescript-eslint to 5 ([#4](https://github.com/Codecademy/client-modules/issues/4)) ([64423d6](https://github.com/Codecademy/client-modules/commit/64423d69ad0f90f2e717373db6b1988b715681cc))
|
|
55
82
|
|
|
83
|
+
### [0.16.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.16.0...@codecademy/tracking@0.16.1) (2021-11-12)
|
|
56
84
|
|
|
85
|
+
### Bug Fixes
|
|
57
86
|
|
|
58
|
-
|
|
87
|
+
- **tracking:** super-bind the sendBeacon to navigator ([b32a8ec](https://github.com/Codecademy/client-modules/commit/b32a8ece14b2c2d62abf98f762f1be17690406f8))
|
|
59
88
|
|
|
89
|
+
## 0.16.0 (2021-11-10)
|
|
60
90
|
|
|
61
|
-
###
|
|
91
|
+
### ⚠ BREAKING CHANGES
|
|
62
92
|
|
|
63
|
-
|
|
93
|
+
- prepended OneTrust to tracking integrations loads
|
|
94
|
+
- clean up tracker and remove auth token
|
|
64
95
|
|
|
96
|
+
### Features
|
|
65
97
|
|
|
98
|
+
- **tracking:** Add source tracking for PWA ([32321cc](https://github.com/Codecademy/client-modules/commit/32321cc489dfd2ada1d967ad6630e849ddebd6e6))
|
|
99
|
+
- **tracking:** ignore known client failures in fetching destinations ([#2](https://github.com/Codecademy/client-modules/issues/2)) ([432549d](https://github.com/Codecademy/client-modules/commit/432549df9b556672eb9b3a321a90d37dd1009b09))
|
|
100
|
+
- add user impression to tracking ([3ec4f61](https://github.com/Codecademy/client-modules/commit/3ec4f6113350859b9d792467ca29b01e0855b4a4))
|
|
101
|
+
- bump ESLint configs to latest ([3a403c0](https://github.com/Codecademy/client-modules/commit/3a403c01358f8b4a0d10d99f8d57e1979ebce189))
|
|
102
|
+
- **event type:** adding business reporting types ([d4a0243](https://github.com/Codecademy/client-modules/commit/d4a0243b6380666850ef0f4bcfcd3c80a065d011)), closes [/github.com/codecademy-engineering/business-reporting/blob/develop/src/util/eventTracking/index.tsx#L104-L110](https://github.com/Codecademy//github.com/codecademy-engineering/business-reporting/blob/develop/src/util/eventTracking/index.tsx/issues/L104-L110)
|
|
103
|
+
- **tracking:** Add a fullstory boolean to TrackingOptions type ([4433669](https://github.com/Codecademy/client-modules/commit/443366955e8beb6aca3337841bf70c583df89f5f))
|
|
104
|
+
- **tracking:** Add a new page_career_path_visited event ([#1283](https://github.com/Codecademy/client-modules/issues/1283)) ([1228399](https://github.com/Codecademy/client-modules/commit/12283990e0bfa0d8d03fb78c83c84cab318e68b1))
|
|
105
|
+
- **tracking:** Added repo-tracking to user events ([d8a72f1](https://github.com/Codecademy/client-modules/commit/d8a72f19afbb02ba6d0aeef7a6b4b2b55820f111))
|
|
106
|
+
- **tracking:** Record the page referrer for every event. ([da11524](https://github.com/Codecademy/client-modules/commit/da11524588571f2ce44bd9af4486b9b64b66408c))
|
|
107
|
+
- **tracking:** Update business event name ([8babbf9](https://github.com/Codecademy/client-modules/commit/8babbf98dad5deb25782aa5b72229c2fea1a6c88))
|
|
108
|
+
- add container_slugs to UserClickData tracking type ([0a70fec](https://github.com/Codecademy/client-modules/commit/0a70fec80c88833bfad73728ae4a52cd54dc659e))
|
|
109
|
+
- added useTrackingIntegrations to tracking package ([b93ca89](https://github.com/Codecademy/client-modules/commit/b93ca897634c62a8d6defb6f6b426395d2daf9f0))
|
|
110
|
+
- clean up tracker and remove auth token ([7d98f82](https://github.com/Codecademy/client-modules/commit/7d98f82f64e48984e0913de83aea0635e93b21d9))
|
|
111
|
+
- Creating the @codecademy/tracking pachage. ([eb2cdca](https://github.com/Codecademy/client-modules/commit/eb2cdca0f1ecf2f77035ffac39e4c7cbe956bed2))
|
|
112
|
+
- onboarded eslint-plugin-simple-import-sort into ESLint plugin ([5eac76b](https://github.com/Codecademy/client-modules/commit/5eac76b95f547f0457360c8f7428af17152d1d67))
|
|
113
|
+
- prepended OneTrust to tracking integrations loads ([9c2e18e](https://github.com/Codecademy/client-modules/commit/9c2e18e35f3f3f538dc3727f4efdde3521708b6c))
|
|
66
114
|
|
|
67
|
-
###
|
|
115
|
+
### Bug Fixes
|
|
68
116
|
|
|
117
|
+
- Add a runtime dependency ([436c3fb](https://github.com/Codecademy/client-modules/commit/436c3fba8812d6f74181de57dca9e8750e371760))
|
|
118
|
+
- Add query params to tracking calls ([#1189](https://github.com/Codecademy/client-modules/issues/1189)) ([6611839](https://github.com/Codecademy/client-modules/commit/661183985d81ca4f75cdfb39a4514f4d7f287d8d))
|
|
119
|
+
- allow no user for tracking integrations ([#1726](https://github.com/Codecademy/client-modules/issues/1726)) ([fa31842](https://github.com/Codecademy/client-modules/commit/fa318421ea2396497bf80fe69ba56063330dd0ed))
|
|
120
|
+
- bump tracking package babel-preset-codecademy to latest ([5c66f67](https://github.com/Codecademy/client-modules/commit/5c66f67c2833993a0dbd6b2e9441b3e590225437))
|
|
121
|
+
- business reporting event types ([2d9fb8e](https://github.com/Codecademy/client-modules/commit/2d9fb8e62d078aed0721df4afae775de2832733f))
|
|
122
|
+
- support navigator.sendBeacon not existing ([79b94cc](https://github.com/Codecademy/client-modules/commit/79b94cc0c140da083a770527a7cf4622c6578a97))
|
|
123
|
+
- switch tracking 'verbose' type back to boolean ([913c870](https://github.com/Codecademy/client-modules/commit/913c8703fb6a06363b324940d7ee406f839e4b53))
|
|
124
|
+
- use old style existence check for navigator.sendBeacon ([f0bf309](https://github.com/Codecademy/client-modules/commit/f0bf30947aa6edb767cab500480a0a71ca147d39))
|
|
69
125
|
|
|
70
|
-
###
|
|
126
|
+
### Reverts
|
|
127
|
+
|
|
128
|
+
- Revert "feat(tracking): Add a fullstory boolean to TrackingOptions type" (#1381) ([376df52](https://github.com/Codecademy/client-modules/commit/376df52daec85208bbaf28760c5fd6bfa5e52810)), closes [#1381](https://github.com/Codecademy/client-modules/issues/1381)
|
|
71
129
|
|
|
72
|
-
|
|
130
|
+
## [0.15.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.14.2...@codecademy/tracking@0.15.0) (2021-10-20)
|
|
73
131
|
|
|
132
|
+
### Features
|
|
74
133
|
|
|
134
|
+
- **tracking:** Add source tracking for PWA ([84a555f](https://github.com/Codecademy/client-modules/commit/84a555fcc8ce5f2b15c20fd7421757e18749514f))
|
|
75
135
|
|
|
76
|
-
### [0.
|
|
136
|
+
### [0.14.2](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.14.1...@codecademy/tracking@0.14.2) (2021-09-13)
|
|
77
137
|
|
|
78
138
|
**Note:** Version bump only for package @codecademy/tracking
|
|
79
139
|
|
|
140
|
+
### [0.14.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.14.0...@codecademy/tracking@0.14.1) (2021-09-10)
|
|
80
141
|
|
|
142
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
81
143
|
|
|
144
|
+
## [0.14.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.13.1...@codecademy/tracking@0.14.0) (2021-09-10)
|
|
82
145
|
|
|
146
|
+
### Features
|
|
83
147
|
|
|
84
|
-
|
|
148
|
+
- bump ESLint configs to latest ([e0a201a](https://github.com/Codecademy/client-modules/commit/e0a201abcc5f49718538d3d91af21cb37db4470e))
|
|
149
|
+
|
|
150
|
+
### [0.13.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.13.0...@codecademy/tracking@0.13.1) (2021-08-13)
|
|
85
151
|
|
|
86
152
|
**Note:** Version bump only for package @codecademy/tracking
|
|
87
153
|
|
|
154
|
+
## [0.13.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.12.1...@codecademy/tracking@0.13.0) (2021-07-20)
|
|
88
155
|
|
|
156
|
+
### Features
|
|
89
157
|
|
|
158
|
+
- **tracking:** Update business event name ([5bfde22](https://github.com/Codecademy/client-modules/commit/5bfde22e22fa76ab000369cf6598b9e0cfec5d63))
|
|
90
159
|
|
|
160
|
+
### [0.12.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.12.0...@codecademy/tracking@0.12.1) (2021-07-13)
|
|
91
161
|
|
|
92
|
-
###
|
|
162
|
+
### Bug Fixes
|
|
93
163
|
|
|
94
|
-
|
|
164
|
+
- business reporting event types ([b480487](https://github.com/Codecademy/client-modules/commit/b480487125ec85aa8466b0225730a2772c88452a))
|
|
95
165
|
|
|
166
|
+
## [0.12.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.11.1...@codecademy/tracking@0.12.0) (2021-07-13)
|
|
96
167
|
|
|
168
|
+
### Features
|
|
97
169
|
|
|
170
|
+
- **event type:** adding business reporting types ([5c8b6c5](https://github.com/Codecademy/client-modules/commit/5c8b6c5fe60b2d415436c56d485d092e6e94f68f)), closes [/github.com/codecademy-engineering/business-reporting/blob/develop/src/util/eventTracking/index.tsx#L104-L110](https://github.com/Codecademy//github.com/codecademy-engineering/business-reporting/blob/develop/src/util/eventTracking/index.tsx/issues/L104-L110)
|
|
98
171
|
|
|
172
|
+
### [0.11.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.11.0...@codecademy/tracking@0.11.1) (2021-06-30)
|
|
99
173
|
|
|
100
|
-
|
|
174
|
+
### Bug Fixes
|
|
175
|
+
|
|
176
|
+
- support navigator.sendBeacon not existing ([ab442ef](https://github.com/Codecademy/client-modules/commit/ab442efb8e097015b5cca2ca34c869e83bb53d44))
|
|
101
177
|
|
|
178
|
+
## [0.11.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.10.0...@codecademy/tracking@0.11.0) (2021-06-30)
|
|
102
179
|
|
|
103
180
|
### Features
|
|
104
181
|
|
|
105
|
-
|
|
182
|
+
- add user impression to tracking ([a5960aa](https://github.com/Codecademy/client-modules/commit/a5960aa034a1725bbcb119a2cf193557bfacd386))
|
|
106
183
|
|
|
184
|
+
## [0.10.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.9.0...@codecademy/tracking@0.10.0) (2021-06-21)
|
|
107
185
|
|
|
186
|
+
### Features
|
|
108
187
|
|
|
109
|
-
|
|
188
|
+
- **tracking:** Added repo-tracking to user events ([22d0d7f](https://github.com/Codecademy/client-modules/commit/22d0d7feb37beb6642ab8fdf09f83480e5919bdf))
|
|
110
189
|
|
|
190
|
+
## [0.9.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.8.0...@codecademy/tracking@0.9.0) (2021-06-10)
|
|
111
191
|
|
|
112
|
-
###
|
|
192
|
+
### Features
|
|
113
193
|
|
|
114
|
-
|
|
194
|
+
- **tracking:** Record the page referrer for every event. ([5ae6357](https://github.com/Codecademy/client-modules/commit/5ae63574671e79e956afdebe8bcf62d81364feae))
|
|
115
195
|
|
|
196
|
+
## [0.8.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.7.3...@codecademy/tracking@0.8.0) (2021-05-24)
|
|
116
197
|
|
|
198
|
+
### ⚠ BREAKING CHANGES
|
|
117
199
|
|
|
118
|
-
|
|
200
|
+
- prepended OneTrust to tracking integrations loads
|
|
119
201
|
|
|
120
|
-
|
|
202
|
+
### Features
|
|
121
203
|
|
|
204
|
+
- prepended OneTrust to tracking integrations loads ([3d8ce05](https://github.com/Codecademy/client-modules/commit/3d8ce05f1669728261f496b604fa8cc5906434e5))
|
|
122
205
|
|
|
206
|
+
### [0.7.3](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.7.2...@codecademy/tracking@0.7.3) (2021-05-10)
|
|
123
207
|
|
|
208
|
+
### Bug Fixes
|
|
124
209
|
|
|
210
|
+
- allow no user for tracking integrations ([#1726](https://github.com/Codecademy/client-modules/issues/1726)) ([66fdf89](https://github.com/Codecademy/client-modules/commit/66fdf89834d2eae53172cd6254d936c182281f0c))
|
|
125
211
|
|
|
126
|
-
### [0.
|
|
212
|
+
### [0.7.2](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.7.1...@codecademy/tracking@0.7.2) (2021-05-03)
|
|
127
213
|
|
|
128
214
|
**Note:** Version bump only for package @codecademy/tracking
|
|
129
215
|
|
|
216
|
+
### [0.7.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.7.0...@codecademy/tracking@0.7.1) (2021-05-03)
|
|
130
217
|
|
|
218
|
+
### Bug Fixes
|
|
131
219
|
|
|
220
|
+
- switch tracking 'verbose' type back to boolean ([8aae870](https://github.com/Codecademy/client-modules/commit/8aae8709b5e755f386f7c9f350ee7a4b86c19bcb))
|
|
132
221
|
|
|
222
|
+
## [0.7.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.6.0...@codecademy/tracking@0.7.0) (2021-05-03)
|
|
133
223
|
|
|
134
|
-
|
|
224
|
+
### ⚠ BREAKING CHANGES
|
|
135
225
|
|
|
226
|
+
- clean up tracker and remove auth token
|
|
136
227
|
|
|
137
228
|
### Features
|
|
138
229
|
|
|
139
|
-
|
|
230
|
+
- clean up tracker and remove auth token ([d2088e9](https://github.com/Codecademy/client-modules/commit/d2088e9741ffaa3e568bf182fb7bb6156ed5bf18))
|
|
140
231
|
|
|
232
|
+
## [0.6.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.5.4...@codecademy/tracking@0.6.0) (2021-05-03)
|
|
141
233
|
|
|
234
|
+
### Features
|
|
142
235
|
|
|
143
|
-
|
|
236
|
+
- added useTrackingIntegrations to tracking package ([2d508e2](https://github.com/Codecademy/client-modules/commit/2d508e2efbcb47968a543d7b54363707301ef351))
|
|
144
237
|
|
|
238
|
+
### [0.5.4](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.5.3...@codecademy/tracking@0.5.4) (2021-05-03)
|
|
145
239
|
|
|
146
|
-
###
|
|
240
|
+
### Bug Fixes
|
|
147
241
|
|
|
148
|
-
|
|
242
|
+
- bump tracking package babel-preset-codecademy to latest ([e809566](https://github.com/Codecademy/client-modules/commit/e80956648e76c3e0b439d4d3a63b3baafd818064))
|
|
149
243
|
|
|
244
|
+
### [0.5.3](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.5.2...@codecademy/tracking@0.5.3) (2021-04-21)
|
|
150
245
|
|
|
246
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
151
247
|
|
|
152
|
-
### [0.2
|
|
248
|
+
### [0.5.2](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.5.1...@codecademy/tracking@0.5.2) (2021-03-19)
|
|
153
249
|
|
|
154
250
|
**Note:** Version bump only for package @codecademy/tracking
|
|
155
251
|
|
|
252
|
+
### [0.5.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.5.0...@codecademy/tracking@0.5.1) (2021-03-04)
|
|
156
253
|
|
|
254
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
157
255
|
|
|
256
|
+
## [0.5.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.4.3...@codecademy/tracking@0.5.0) (2021-02-18)
|
|
158
257
|
|
|
258
|
+
### Features
|
|
159
259
|
|
|
160
|
-
|
|
260
|
+
- add container_slugs to UserClickData tracking type ([ebb2d18](https://github.com/Codecademy/client-modules/commit/ebb2d1873505d7c09e14a0f714e5661914e8dd4a))
|
|
161
261
|
|
|
262
|
+
### [0.4.3](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.4.2...@codecademy/tracking@0.4.3) (2021-02-10)
|
|
263
|
+
|
|
264
|
+
### Reverts
|
|
265
|
+
|
|
266
|
+
- Revert "feat(tracking): Add a fullstory boolean to TrackingOptions type" (#1381) ([f04d8b5](https://github.com/Codecademy/client-modules/commit/f04d8b57cac13dfffc8951641e52c2593827aba9)), closes [#1381](https://github.com/Codecademy/client-modules/issues/1381)
|
|
267
|
+
|
|
268
|
+
### [0.4.2](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.4.1...@codecademy/tracking@0.4.2) (2021-02-04)
|
|
269
|
+
|
|
270
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
271
|
+
|
|
272
|
+
### [0.4.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.4.0...@codecademy/tracking@0.4.1) (2021-02-02)
|
|
273
|
+
|
|
274
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
275
|
+
|
|
276
|
+
## [0.4.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.3.0...@codecademy/tracking@0.4.0) (2021-01-14)
|
|
162
277
|
|
|
163
278
|
### Features
|
|
164
279
|
|
|
165
|
-
|
|
280
|
+
- **tracking:** Add a new page_career_path_visited event ([#1283](https://github.com/Codecademy/client-modules/issues/1283)) ([398e863](https://github.com/Codecademy/client-modules/commit/398e8636ed1ae5dc602f8ed103583b73aa0d6abc))
|
|
166
281
|
|
|
282
|
+
## [0.3.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.2.1...@codecademy/tracking@0.3.0) (2021-01-12)
|
|
167
283
|
|
|
284
|
+
### Features
|
|
168
285
|
|
|
169
|
-
|
|
286
|
+
- **tracking:** Add a fullstory boolean to TrackingOptions type ([8e58696](https://github.com/Codecademy/client-modules/commit/8e58696cda506c8b9fed5a6b58eadcf0d9ebcfab))
|
|
287
|
+
|
|
288
|
+
### [0.2.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.2.0...@codecademy/tracking@0.2.1) (2020-12-14)
|
|
170
289
|
|
|
171
290
|
**Note:** Version bump only for package @codecademy/tracking
|
|
172
291
|
|
|
292
|
+
## [0.2.0](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.1.3...@codecademy/tracking@0.2.0) (2020-12-11)
|
|
173
293
|
|
|
294
|
+
### Features
|
|
174
295
|
|
|
296
|
+
- onboarded eslint-plugin-simple-import-sort into ESLint plugin ([59d6fe5](https://github.com/Codecademy/client-modules/commit/59d6fe54d9af4b3ba2a88f7c234f65fc63506c0c))
|
|
175
297
|
|
|
298
|
+
### [0.1.3](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.1.2...@codecademy/tracking@0.1.3) (2020-12-07)
|
|
176
299
|
|
|
177
|
-
|
|
300
|
+
**Note:** Version bump only for package @codecademy/tracking
|
|
178
301
|
|
|
302
|
+
### [0.1.2](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.1.1...@codecademy/tracking@0.1.2) (2020-11-25)
|
|
179
303
|
|
|
180
304
|
### 🐛 Bug Fixes
|
|
181
305
|
|
|
182
|
-
|
|
306
|
+
- Add query params to tracking calls ([#1189](https://github.com/Codecademy/client-modules/issues/1189)) ([02438ae](https://github.com/Codecademy/client-modules/commit/02438ae4fbad0130b8ef3e8de3a22f07922c9eed))
|
|
183
307
|
|
|
184
308
|
### [0.1.1](https://github.com/Codecademy/client-modules/compare/@codecademy/tracking@0.1.0...@codecademy/tracking@0.1.1) (2020-10-23)
|
|
185
309
|
|
|
186
|
-
|
|
187
310
|
### 🐛 Bug Fixes
|
|
188
311
|
|
|
189
|
-
|
|
312
|
+
- Add a runtime dependency ([524d37b](https://github.com/Codecademy/client-modules/commit/524d37b08586903bc6a9d2b7a060752521bfc748))
|
|
190
313
|
|
|
191
314
|
## [0.1.0](https://github.com/Codecademy/client-modules/compare/1a91e7e41e9a30e3cabb3b736c1b686c43e9570e...@codecademy/tracking@0.1.0) (2020-10-23)
|
|
192
315
|
|
|
193
|
-
|
|
194
316
|
### ✨ Features
|
|
195
317
|
|
|
196
|
-
|
|
318
|
+
- Creating the @codecademy/tracking pachage. ([1a91e7e](https://github.com/Codecademy/client-modules/commit/1a91e7e41e9a30e3cabb3b736c1b686c43e9570e))
|
package/LICENSE
CHANGED
package/babel.config.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
extends: '../../babel.defaults.js',
|
|
2
3
|
presets: ['codecademy', '@babel/preset-typescript'],
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
plugins: [
|
|
5
|
+
[
|
|
6
|
+
'@emotion/babel-plugin',
|
|
7
|
+
{
|
|
8
|
+
sourceMap: true,
|
|
9
|
+
autoLabel: 'always',
|
|
10
|
+
labelFormat: '[local]',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
],
|
|
5
14
|
};
|
package/dist/events/track.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type { EventDataTypes, TrackingOptions, UserClickData, UserVisitData } from './types';
|
|
1
|
+
import type { BaseEventData, EventDataTypes, TrackingOptions, UserClickData, UserImpressionData, UserVisitData } from './types';
|
|
2
2
|
export declare type TrackerOptions = {
|
|
3
3
|
apiBaseUrl: string;
|
|
4
4
|
verbose?: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare const createTracker: ({ apiBaseUrl, verbose }: TrackerOptions) => {
|
|
7
|
-
event: <Category extends keyof EventDataTypes, Event_1 extends string & keyof EventDataTypes[Category], Data extends EventDataTypes[Category][Event_1]>(category: Category, event: Event_1, userData: Data, options?: TrackingOptions) => void;
|
|
7
|
+
event: <Category extends keyof EventDataTypes, Event_1 extends string & keyof EventDataTypes[Category], Data extends EventDataTypes[Category][Event_1] & BaseEventData>(category: Category, event: Event_1, userData: Data, options?: TrackingOptions) => void;
|
|
8
8
|
click: (data: UserClickData) => void;
|
|
9
|
+
impression: (data: UserImpressionData) => void;
|
|
9
10
|
visit: (data: UserVisitData) => void;
|
|
10
11
|
pushDataLayerEvent: (eventName: string) => void;
|
|
11
12
|
};
|
package/dist/events/track.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
1
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2
2
|
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
@@ -12,17 +12,22 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
12
12
|
|
|
13
13
|
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; }
|
|
14
14
|
|
|
15
|
-
function _iterableToArrayLimit(arr, i) {
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
16
|
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
import { getClientType } from '../integrations/device';
|
|
20
|
+
|
|
21
|
+
var browserSupportsKeepalive = function browserSupportsKeepalive() {
|
|
22
|
+
return 'keepalive' in window.Request.prototype;
|
|
23
|
+
};
|
|
24
|
+
|
|
20
25
|
export var createTracker = function createTracker(_ref) {
|
|
21
26
|
var apiBaseUrl = _ref.apiBaseUrl,
|
|
22
27
|
verbose = _ref.verbose;
|
|
23
28
|
|
|
24
29
|
var beacon = function beacon(endpoint, data) {
|
|
25
|
-
var uri = new URL(endpoint, apiBaseUrl);
|
|
30
|
+
var uri = new URL(endpoint, apiBaseUrl).toString();
|
|
26
31
|
var form = new FormData();
|
|
27
32
|
|
|
28
33
|
for (var _i2 = 0, _Object$entries = Object.entries(data); _i2 < _Object$entries.length; _i2++) {
|
|
@@ -35,7 +40,24 @@ export var createTracker = function createTracker(_ref) {
|
|
|
35
40
|
form.append(k, v.toString());
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
try {
|
|
44
|
+
// Firefox allows users to disable navigator.sendBeacon, and very old Safari versions don't have it.
|
|
45
|
+
// [WEB-1700]: Additionally, Chrome 79-80 gives "Illegal invocation" with ?., so through 2022 we should support them.
|
|
46
|
+
// It seems similar to this: https://github.com/vercel/next.js/issues/23856
|
|
47
|
+
if (navigator.sendBeacon && navigator.sendBeacon(uri, form)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
} catch (_unused) {// Even with the proper scoping, Chrome 79-80 still gives "Illegal invocation" crashes. Sigh.
|
|
51
|
+
} // Either way, we fall back to standard fetch if sendBeacon fails.
|
|
52
|
+
// We don't mind this rejecting with an error because it's tracking, and we'll know if that starts to fail.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
window.fetch(uri, _objectSpread({
|
|
56
|
+
method: 'POST',
|
|
57
|
+
body: form
|
|
58
|
+
}, browserSupportsKeepalive() && {
|
|
59
|
+
keepalive: true
|
|
60
|
+
}));
|
|
39
61
|
};
|
|
40
62
|
|
|
41
63
|
var event = function event(category, _event, userData) {
|
|
@@ -46,7 +68,9 @@ export var createTracker = function createTracker(_ref) {
|
|
|
46
68
|
search: window.location.search,
|
|
47
69
|
path: window.location.pathname,
|
|
48
70
|
title: window.document.title,
|
|
49
|
-
url: window.location.href
|
|
71
|
+
url: window.location.href,
|
|
72
|
+
referrer: userData.referrer || window.document.referrer,
|
|
73
|
+
client: getClientType()
|
|
50
74
|
});
|
|
51
75
|
|
|
52
76
|
if (verbose) {
|
|
@@ -74,6 +98,9 @@ export var createTracker = function createTracker(_ref) {
|
|
|
74
98
|
click: function click(data) {
|
|
75
99
|
return event('user', 'click', data);
|
|
76
100
|
},
|
|
101
|
+
impression: function impression(data) {
|
|
102
|
+
return event('user', 'impression', data);
|
|
103
|
+
},
|
|
77
104
|
visit: function visit(data) {
|
|
78
105
|
return event('user', 'visit', data);
|
|
79
106
|
},
|
package/dist/events/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare type EventDataTypes = {
|
|
|
7
7
|
user: {
|
|
8
8
|
click: UserClickData;
|
|
9
9
|
visit: UserVisitData;
|
|
10
|
-
impression:
|
|
10
|
+
impression: UserImpressionData;
|
|
11
11
|
email_trigger: BaseEventAnyData;
|
|
12
12
|
content_completed: BaseEventAnyData;
|
|
13
13
|
submit: BaseEventAnyData;
|
|
@@ -42,6 +42,9 @@ export declare type EventDataTypes = {
|
|
|
42
42
|
exercise: {
|
|
43
43
|
force_pass: BaseEventAnyData;
|
|
44
44
|
};
|
|
45
|
+
experiment: {
|
|
46
|
+
contentful_experiment_assignment_event: BaseEventAnyData;
|
|
47
|
+
};
|
|
45
48
|
payments: {
|
|
46
49
|
cancel_survey: BaseEventAnyData;
|
|
47
50
|
};
|
|
@@ -56,6 +59,10 @@ export declare type EventDataTypes = {
|
|
|
56
59
|
skill_path_visited: PagePathVisitedData;
|
|
57
60
|
course_page_visited: CoursePageVisitedData;
|
|
58
61
|
};
|
|
62
|
+
business: {
|
|
63
|
+
filter_event: BusinessFilterData;
|
|
64
|
+
search_event: BusinessSearchData;
|
|
65
|
+
};
|
|
59
66
|
};
|
|
60
67
|
/**
|
|
61
68
|
* Base event data shared by all events
|
|
@@ -66,6 +73,7 @@ export declare type BaseEventData = {
|
|
|
66
73
|
path?: null;
|
|
67
74
|
title?: null;
|
|
68
75
|
url?: null;
|
|
76
|
+
referrer?: string | null;
|
|
69
77
|
id?: null;
|
|
70
78
|
};
|
|
71
79
|
/**
|
|
@@ -97,6 +105,7 @@ export declare type TrackingContentIds = {
|
|
|
97
105
|
program_unit_id?: string;
|
|
98
106
|
review_card_id?: string;
|
|
99
107
|
track_id?: string;
|
|
108
|
+
journey_id?: string;
|
|
100
109
|
};
|
|
101
110
|
/**
|
|
102
111
|
* Shared data relevant for all user events
|
|
@@ -112,7 +121,12 @@ export declare type UserSharedData = BaseEventData & {
|
|
|
112
121
|
href?: string;
|
|
113
122
|
/** a version id for the element (ex. different version ids for redesigns) */
|
|
114
123
|
version?: string;
|
|
124
|
+
/** an object of content ids related to this event */
|
|
115
125
|
content_ids?: TrackingContentIds;
|
|
126
|
+
/** the repo that this event is being fired from */
|
|
127
|
+
source_codebase?: string;
|
|
128
|
+
/** Should be used for arbitrary JSON that has been passed through JSON.stringify. */
|
|
129
|
+
misc?: string;
|
|
116
130
|
};
|
|
117
131
|
/**
|
|
118
132
|
* Data sent to user click event table
|
|
@@ -157,6 +171,9 @@ export declare type UserClickData = UserSharedData & {
|
|
|
157
171
|
course_progress?: number;
|
|
158
172
|
assessment_id?: string;
|
|
159
173
|
container_slugs?: string[];
|
|
174
|
+
search_id?: string;
|
|
175
|
+
is_ugc?: boolean;
|
|
176
|
+
business_user?: BaseEventAnyData;
|
|
160
177
|
};
|
|
161
178
|
/**
|
|
162
179
|
* Data sent to user visit event table
|
|
@@ -184,6 +201,13 @@ export declare type UserVisitData = UserSharedData & {
|
|
|
184
201
|
story_slug?: string;
|
|
185
202
|
unit?: string;
|
|
186
203
|
lesson?: string;
|
|
204
|
+
is_ugc?: boolean;
|
|
205
|
+
};
|
|
206
|
+
export declare type UserImpressionData = Pick<UserSharedData, 'context' | 'source_codebase' | 'content_ids'> & {
|
|
207
|
+
page_name: string;
|
|
208
|
+
target: string;
|
|
209
|
+
slug?: string;
|
|
210
|
+
is_ugc?: boolean;
|
|
187
211
|
};
|
|
188
212
|
export declare type EventAnswerData = BaseEventData & {
|
|
189
213
|
question_index: number;
|
|
@@ -216,3 +240,11 @@ export declare type CoursePageVisitedData = BaseEventData & {
|
|
|
216
240
|
course_id: string;
|
|
217
241
|
course_full_title: string;
|
|
218
242
|
};
|
|
243
|
+
export declare type FilterType = string | string[] | number | boolean;
|
|
244
|
+
export declare type BusinessFilterData = BaseEventData & {
|
|
245
|
+
filter_key: string;
|
|
246
|
+
filter_value: FilterType;
|
|
247
|
+
};
|
|
248
|
+
export declare type BusinessSearchData = BaseEventData & {
|
|
249
|
+
search_query: string;
|
|
250
|
+
};
|
package/dist/events/types.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|