@rudderstack/analytics-js 3.0.0-beta.2 → 3.0.0-beta.20
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +200 -3
- package/README.md +57 -10
- package/dist/npm/index.d.ts +1335 -0
- package/dist/npm/legacy/cjs/index.js +3801 -0
- package/dist/npm/legacy/esm/index.js +3799 -0
- package/dist/npm/legacy/umd/index.js +3807 -0
- package/dist/npm/modern/bundled/cjs/index.js +3257 -0
- package/dist/npm/modern/bundled/esm/index.js +3253 -0
- package/dist/npm/modern/bundled/umd/index.js +3263 -0
- package/{modern → dist/npm/modern}/cjs/index.js +427 -516
- package/dist/npm/modern/content-script/cjs/index.js +3233 -0
- package/dist/npm/modern/content-script/esm/index.js +3229 -0
- package/dist/npm/modern/content-script/umd/index.js +3239 -0
- package/{modern → dist/npm/modern}/esm/index.js +428 -512
- package/{modern → dist/npm/modern}/umd/index.js +427 -516
- package/package.json +46 -118
- package/index.d.ts +0 -387
- package/legacy/cjs/index.js +0 -3887
- package/legacy/esm/index.js +0 -3880
- package/legacy/umd/index.js +0 -3893
package/CHANGELOG.md
CHANGED
@@ -1,7 +1,204 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
|
+
|
5
|
+
## [3.0.0-beta.20](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.19...@rudderstack/analytics-js@3.0.0-beta.20) (2024-01-19)
|
6
|
+
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
* attach global error listeners ([#1586](https://github.com/rudderlabs/rudder-sdk-js/issues/1586)) ([b416897](https://github.com/rudderlabs/rudder-sdk-js/commit/b416897445c0e27b13853af44ed203daefd3f720))
|
11
|
+
|
12
|
+
## [3.0.0-beta.19](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.18...@rudderstack/analytics-js@3.0.0-beta.19) (2024-01-08)
|
13
|
+
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
* enhance error handling ([#1568](https://github.com/rudderlabs/rudder-sdk-js/issues/1568)) ([0f08ba4](https://github.com/rudderlabs/rudder-sdk-js/commit/0f08ba4009de27647e2220aa2e56e30d5a99e902))
|
18
|
+
* localstorage retry patch and upgrade packages ([#1573](https://github.com/rudderlabs/rudder-sdk-js/issues/1573)) ([b14d027](https://github.com/rudderlabs/rudder-sdk-js/commit/b14d0276cc7dedf87062530eab404f7a924fecf7))
|
19
|
+
|
20
|
+
## [3.0.0-beta.18](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.17...@rudderstack/analytics-js@3.0.0-beta.18) (2023-12-13)
|
21
|
+
|
22
|
+
|
23
|
+
### Bug Fixes
|
24
|
+
|
25
|
+
* **analytics-js:** new export that excludes all third party host scripts ([#1533](https://github.com/rudderlabs/rudder-sdk-js/issues/1533)) ([999d8fa](https://github.com/rudderlabs/rudder-sdk-js/commit/999d8fa0262e7cd7b021404ec28a99fc64dd323d))
|
26
|
+
|
27
|
+
## [3.0.0-beta.17](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.16...@rudderstack/analytics-js@3.0.0-beta.17) (2023-12-06)
|
28
|
+
|
29
|
+
|
30
|
+
### Bug Fixes
|
31
|
+
|
32
|
+
* **analytics-js:** post ready callback invocations ([#1535](https://github.com/rudderlabs/rudder-sdk-js/issues/1535)) ([996fb9a](https://github.com/rudderlabs/rudder-sdk-js/commit/996fb9ad47bd9a28da533c5807873ea71f2f1f24))
|
33
|
+
|
34
|
+
## [3.0.0-beta.16](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.15...@rudderstack/analytics-js@3.0.0-beta.16) (2023-12-01)
|
35
|
+
|
36
|
+
|
37
|
+
### Features
|
38
|
+
|
39
|
+
* **analytics-js-loading-scripts:** add loading snippet version in event context ([#1483](https://github.com/rudderlabs/rudder-sdk-js/issues/1483)) ([4873cbc](https://github.com/rudderlabs/rudder-sdk-js/commit/4873cbc183879c0c1825cf939a53b6cf570cdf4e))
|
40
|
+
|
41
|
+
|
42
|
+
### Bug Fixes
|
43
|
+
|
44
|
+
* initialisation of bugsnag in chrome extension ([#1516](https://github.com/rudderlabs/rudder-sdk-js/issues/1516)) ([af970c9](https://github.com/rudderlabs/rudder-sdk-js/commit/af970c94ad45c50fcbbca0d0e7597fdefa08b154))
|
45
|
+
* multiple onReady invocation ([#1522](https://github.com/rudderlabs/rudder-sdk-js/issues/1522)) ([bf3b09b](https://github.com/rudderlabs/rudder-sdk-js/commit/bf3b09bef82eaf13f34bd538a080fd9f5e557e78))
|
46
|
+
* update polyfill list and add version ([#1518](https://github.com/rudderlabs/rudder-sdk-js/issues/1518)) ([653d58e](https://github.com/rudderlabs/rudder-sdk-js/commit/653d58e782c7449c7f7afe851665a59912287750))
|
47
|
+
|
48
|
+
## [3.0.0-beta.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.14...@rudderstack/analytics-js@3.0.0-beta.15) (2023-11-13)
|
49
|
+
|
50
|
+
|
51
|
+
### Features
|
52
|
+
|
53
|
+
* add beacon polyfill ([#1487](https://github.com/rudderlabs/rudder-sdk-js/issues/1487)) ([8053ae2](https://github.com/rudderlabs/rudder-sdk-js/commit/8053ae2ec7c5757bb65a1881ca1b79fe08c30fc7))
|
54
|
+
* buffer consent method invocations ([#1501](https://github.com/rudderlabs/rudder-sdk-js/issues/1501)) ([70f6f64](https://github.com/rudderlabs/rudder-sdk-js/commit/70f6f64500b6b08bbb657498ec0e1fdecf72b82c))
|
55
|
+
* consent api wrap up ([#1477](https://github.com/rudderlabs/rudder-sdk-js/issues/1477)) ([edc78ac](https://github.com/rudderlabs/rudder-sdk-js/commit/edc78ac54235aabfc8d1d78f961fbd650a3b7c73))
|
56
|
+
* reinitialize persistent data from consent options ([#1465](https://github.com/rudderlabs/rudder-sdk-js/issues/1465)) ([43f30b7](https://github.com/rudderlabs/rudder-sdk-js/commit/43f30b7296ae9a0862810fd0b3c520e8bddf614c))
|
57
|
+
|
58
|
+
|
59
|
+
### Bug Fixes
|
60
|
+
|
61
|
+
* gcm post consent issues ([#1507](https://github.com/rudderlabs/rudder-sdk-js/issues/1507)) ([6241d3d](https://github.com/rudderlabs/rudder-sdk-js/commit/6241d3da28edc9b5f478774a763226d9d72f7dcc))
|
62
|
+
* gcm qa fixes ([#1499](https://github.com/rudderlabs/rudder-sdk-js/issues/1499)) ([84ca784](https://github.com/rudderlabs/rudder-sdk-js/commit/84ca784e6848e7fd8988c4a93db46d4636f2f89c))
|
63
|
+
* storage migration to allow empty string values ([#1488](https://github.com/rudderlabs/rudder-sdk-js/issues/1488)) ([b639fa1](https://github.com/rudderlabs/rudder-sdk-js/commit/b639fa17f22d1bbad951b293c9edba36f164163e))
|
64
|
+
|
65
|
+
## [3.0.0-beta.14](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.13...@rudderstack/analytics-js@3.0.0-beta.14) (2023-10-27)
|
66
|
+
|
67
|
+
|
68
|
+
### Features
|
69
|
+
|
70
|
+
* alter life cycle for pre consent ([#1411](https://github.com/rudderlabs/rudder-sdk-js/issues/1411)) ([60ec092](https://github.com/rudderlabs/rudder-sdk-js/commit/60ec0924a1229678fb16d76a34a494c40a622a11))
|
71
|
+
* auto capture timezone as a part of context ([#1464](https://github.com/rudderlabs/rudder-sdk-js/issues/1464)) ([8e66069](https://github.com/rudderlabs/rudder-sdk-js/commit/8e660693d75727d2131a57ca57859e6d0b920e84))
|
72
|
+
* configure cookie to be fetched from exact domain ([#1468](https://github.com/rudderlabs/rudder-sdk-js/issues/1468)) ([4db1b10](https://github.com/rudderlabs/rudder-sdk-js/commit/4db1b10b45b4ffcd652aec6bd684943ca35c6c08))
|
73
|
+
* consent api ([#1458](https://github.com/rudderlabs/rudder-sdk-js/issues/1458)) ([216b405](https://github.com/rudderlabs/rudder-sdk-js/commit/216b405f7c319d5ff2d799d2e3a5efe2ee4a03af))
|
74
|
+
|
75
|
+
|
76
|
+
### Bug Fixes
|
77
|
+
|
78
|
+
* **analytics-js:** correct declared global extended type ([#1460](https://github.com/rudderlabs/rudder-sdk-js/issues/1460)) ([3f15290](https://github.com/rudderlabs/rudder-sdk-js/commit/3f1529037ba0541391b5f8033e37f867fdd7931c))
|
79
|
+
* **analytics-js:** fix remote import error when npm package is bundled with webpack ([#1466](https://github.com/rudderlabs/rudder-sdk-js/issues/1466)) ([3a818ac](https://github.com/rudderlabs/rudder-sdk-js/commit/3a818accd24e6b3667c75a6b60fb12aba36bdf7e))
|
80
|
+
* **monorepo:** update vulnerable dependencies ([#1457](https://github.com/rudderlabs/rudder-sdk-js/issues/1457)) ([7a4bc4c](https://github.com/rudderlabs/rudder-sdk-js/commit/7a4bc4cc641e4fff2a8f561ce6fd67d16c0cd5a0))
|
81
|
+
* upgrade vulnerable cryptoJS dependency, rolup to v4 & NX to v17 ([#1471](https://github.com/rudderlabs/rudder-sdk-js/issues/1471)) ([b2bb21c](https://github.com/rudderlabs/rudder-sdk-js/commit/b2bb21cb3f618f6c86f593d1706abe9e6349066d))
|
82
|
+
|
83
|
+
## [3.0.0-beta.13](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.12...@rudderstack/analytics-js@3.0.0-beta.13) (2023-10-16)
|
84
|
+
|
85
|
+
|
86
|
+
### Features
|
87
|
+
|
88
|
+
* add support for session storage ([#1440](https://github.com/rudderlabs/rudder-sdk-js/issues/1440)) ([7e3106b](https://github.com/rudderlabs/rudder-sdk-js/commit/7e3106b5317af05ad28a9c0c22a50638dbaebdc2))
|
89
|
+
* **analytics-js-service-worker:** deprecate service worker export of rudder-sdk-js package in favor of the new standalone package([#1437](https://github.com/rudderlabs/rudder-sdk-js/issues/1437)) ([1797d3e](https://github.com/rudderlabs/rudder-sdk-js/commit/1797d3ef356e947a528c2de9abcfde245cc28178))
|
90
|
+
* dmt plugin for v3 ([#1412](https://github.com/rudderlabs/rudder-sdk-js/issues/1412)) ([97ee68a](https://github.com/rudderlabs/rudder-sdk-js/commit/97ee68a27daa5ce8c3a098cdc84c4ee7981f1149))
|
91
|
+
|
92
|
+
|
93
|
+
### Bug Fixes
|
94
|
+
|
95
|
+
* **analytics-js-loading-scripts:** add globalThis polyfill for safari ([#1446](https://github.com/rudderlabs/rudder-sdk-js/issues/1446)) ([bf111f8](https://github.com/rudderlabs/rudder-sdk-js/commit/bf111f8fc24fe75d183ea4924423e3c560ce457d))
|
96
|
+
* **analytics-js:** add global definitions extended window type ([#1445](https://github.com/rudderlabs/rudder-sdk-js/issues/1445)) ([b995635](https://github.com/rudderlabs/rudder-sdk-js/commit/b995635a7a3979173d35b34fa32b41b4429b166f))
|
97
|
+
* empty anonymous id after reset call ([#1433](https://github.com/rudderlabs/rudder-sdk-js/issues/1433)) ([b078347](https://github.com/rudderlabs/rudder-sdk-js/commit/b0783478917a75833f6e7133f10ad5f8999866de))
|
98
|
+
* identify traits type ([#1427](https://github.com/rudderlabs/rudder-sdk-js/issues/1427)) ([a58c919](https://github.com/rudderlabs/rudder-sdk-js/commit/a58c919ca36fc4e14d134455a08fe0e35f3e66ce))
|
99
|
+
* pass anonymous id load option to getanonymousid method ([#1443](https://github.com/rudderlabs/rudder-sdk-js/issues/1443)) ([e234a8f](https://github.com/rudderlabs/rudder-sdk-js/commit/e234a8fa7538ac84fbf451aa4b104c1b26b5a04e))
|
100
|
+
|
101
|
+
## [3.0.0-beta.12](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.11...@rudderstack/analytics-js@3.0.0-beta.12) (2023-10-02)
|
102
|
+
|
103
|
+
|
104
|
+
### Bug Fixes
|
105
|
+
|
106
|
+
* **analytics-js,rudder-sdk-js:** dead object issue ([#1410](https://github.com/rudderlabs/rudder-sdk-js/issues/1410)) ([94f4b2d](https://github.com/rudderlabs/rudder-sdk-js/commit/94f4b2db11b32a6b4ddcb2b1eacf7cdbd1867ef3))
|
107
|
+
|
108
|
+
## [3.0.0-beta.11](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.10...@rudderstack/analytics-js@3.0.0-beta.11) (2023-09-26)
|
109
|
+
|
110
|
+
|
111
|
+
### Bug Fixes
|
112
|
+
|
113
|
+
* **analytics-js-plugins:** add IE11 compatibility for crypto-es ([#1407](https://github.com/rudderlabs/rudder-sdk-js/issues/1407)) ([483ae44](https://github.com/rudderlabs/rudder-sdk-js/commit/483ae44ec59a5ddd72c0187e1c55128967e4289a))
|
114
|
+
|
115
|
+
## [3.0.0-beta.10](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.9...@rudderstack/analytics-js@3.0.0-beta.10) (2023-09-26)
|
116
|
+
|
117
|
+
|
118
|
+
### Features
|
119
|
+
|
120
|
+
* optimize plugin chunks ([#1379](https://github.com/rudderlabs/rudder-sdk-js/issues/1379)) ([5acfa4d](https://github.com/rudderlabs/rudder-sdk-js/commit/5acfa4d61d85e01c44252749074021d0a782b59e))
|
121
|
+
|
122
|
+
|
123
|
+
### Bug Fixes
|
124
|
+
|
125
|
+
* **analytics-js:** enforce default cloud mode events delivery plugin ([#1402](https://github.com/rudderlabs/rudder-sdk-js/issues/1402)) ([e06d9b8](https://github.com/rudderlabs/rudder-sdk-js/commit/e06d9b80cd029e11a394f5a4e2069313f69b9349))
|
126
|
+
* plugins registering twice ([#1380](https://github.com/rudderlabs/rudder-sdk-js/issues/1380)) ([9de8f28](https://github.com/rudderlabs/rudder-sdk-js/commit/9de8f280f27245bcc0284d5033ce8ccbf05abe1b))
|
127
|
+
|
128
|
+
## [3.0.0-beta.9](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.8...@rudderstack/analytics-js@3.0.0-beta.9) (2023-09-20)
|
129
|
+
|
130
|
+
## [3.0.0-beta.8](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.7...@rudderstack/analytics-js@3.0.0-beta.8) (2023-09-18)
|
131
|
+
|
132
|
+
|
133
|
+
### Features
|
134
|
+
|
135
|
+
* deprecate support of common names for integrations ([#1374](https://github.com/rudderlabs/rudder-sdk-js/issues/1374)) ([f1d097d](https://github.com/rudderlabs/rudder-sdk-js/commit/f1d097d9976f6c9d2ad0f1d81d469148f8c7c197))
|
136
|
+
|
137
|
+
## [3.0.0-beta.7](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.6...@rudderstack/analytics-js@3.0.0-beta.7) (2023-09-14)
|
138
|
+
|
139
|
+
|
140
|
+
### Features
|
141
|
+
|
142
|
+
* granular control of persisted data storing with auto migration ([#1329](https://github.com/rudderlabs/rudder-sdk-js/issues/1329)) ([b709edc](https://github.com/rudderlabs/rudder-sdk-js/commit/b709edcbf9314d26fb9cd0af5fa8790330853d9c))
|
143
|
+
* new load options for pre-consent configuration ([#1363](https://github.com/rudderlabs/rudder-sdk-js/issues/1363)) ([363a524](https://github.com/rudderlabs/rudder-sdk-js/commit/363a5242b607ed7bcb21f2847d15c6b399d0b6a9))
|
144
|
+
|
145
|
+
|
146
|
+
### Bug Fixes
|
147
|
+
|
148
|
+
* getsessionid updating the sessionstart status ([#1370](https://github.com/rudderlabs/rudder-sdk-js/issues/1370)) ([510bb06](https://github.com/rudderlabs/rudder-sdk-js/commit/510bb0604c559f7f5d98f721e79c106243fe542f))
|
149
|
+
|
150
|
+
# [3.0.0-beta.6](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.5...@rudderstack/analytics-js@3.0.0-beta.6) (2023-08-30)
|
151
|
+
|
152
|
+
|
153
|
+
### Bug Fixes
|
154
|
+
|
155
|
+
* forward only supported calls to the log provider ([#1333](https://github.com/rudderlabs/rudder-sdk-js/issues/1333)) ([a4c0743](https://github.com/rudderlabs/rudder-sdk-js/commit/a4c07434a35a778c81088475726f100f06abb7b0))
|
156
|
+
* handle errors for cookies data URI encode and decode ([#1350](https://github.com/rudderlabs/rudder-sdk-js/issues/1350)) ([b25ff6c](https://github.com/rudderlabs/rudder-sdk-js/commit/b25ff6c7f392d85ef9eb77293bfdf39b96207c51))
|
157
|
+
|
158
|
+
|
159
|
+
### Features
|
160
|
+
|
161
|
+
* add batching support to xhr plugin ([#1301](https://github.com/rudderlabs/rudder-sdk-js/issues/1301)) ([0421663](https://github.com/rudderlabs/rudder-sdk-js/commit/04216637a00dc5339cf466a586137415b46b6b49))
|
162
|
+
* add callback for polyfill load ([#1335](https://github.com/rudderlabs/rudder-sdk-js/issues/1335)) ([6ba9329](https://github.com/rudderlabs/rudder-sdk-js/commit/6ba932918dd03c110c92cd5837a2f8ca0f9cf192))
|
163
|
+
* add resize event handler to update screen info ([#1336](https://github.com/rudderlabs/rudder-sdk-js/issues/1336)) ([be05226](https://github.com/rudderlabs/rudder-sdk-js/commit/be0522668f44667d7d3a8082db89a7e4cad316c8))
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
# [3.0.0-beta.5](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.4...@rudderstack/analytics-js@3.0.0-beta.5) (2023-08-21)
|
170
|
+
|
171
|
+
|
172
|
+
### Bug Fixes
|
173
|
+
|
174
|
+
* **analytics-js:** update context page details in every event creation ([#1317](https://github.com/rudderlabs/rudder-sdk-js/issues/1317)) ([45c2300](https://github.com/rudderlabs/rudder-sdk-js/commit/45c230094aceb8176d92e7958fcb6910ebc61248))
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
# [3.0.0-beta.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.3...@rudderstack/analytics-js@3.0.0-beta.4) (2023-08-17)
|
181
|
+
|
182
|
+
|
183
|
+
### Bug Fixes
|
184
|
+
|
185
|
+
* **analytics-js:** fix SPA url change not reflecting in context page ([22c13bf](https://github.com/rudderlabs/rudder-sdk-js/commit/22c13bf7a3bdd632b7616995404548d7ea36d5a3))
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
# [3.0.0-beta.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.0.0-beta.2...@rudderstack/analytics-js@3.0.0-beta.3) (2023-08-10)
|
192
|
+
|
193
|
+
|
194
|
+
### Bug Fixes
|
195
|
+
|
196
|
+
* **analytics-js:** add polyfill and feature detection for CustomEvent ([92c565f](https://github.com/rudderlabs/rudder-sdk-js/commit/92c565fca6ee2c90e0d7c34426e9a502d06ca745))
|
197
|
+
* **analytics-js:** change default cdn paths to the beta ones ([8d4bbe4](https://github.com/rudderlabs/rudder-sdk-js/commit/8d4bbe4bbf8be60dbdf0d07244a11da8f1948e5f))
|
198
|
+
|
199
|
+
|
200
|
+
|
2
201
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
202
|
|
6
203
|
# 3.0.0-beta.2 (2023-08-09)
|
7
204
|
|
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<p align="center">
|
4
4
|
<a href="https://rudderstack.com/">
|
5
|
-
<img src="https://
|
5
|
+
<img alt="RudderStack" width="512" src="https://raw.githubusercontent.com/rudderlabs/rudder-sdk-js/develop/assets/rs-logo-full-light.jpg">
|
6
6
|
</a>
|
7
7
|
<br />
|
8
8
|
<caption>The Customer Data Platform for Developers</caption>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
---
|
21
21
|
|
22
|
-
#
|
22
|
+
# @rudderstack/analytics-js
|
23
23
|
|
24
24
|
RudderStack Javascript SDK for browsers.
|
25
25
|
|
@@ -27,9 +27,12 @@ RudderStack Javascript SDK for browsers.
|
|
27
27
|
|
28
28
|
## Table of Contents
|
29
29
|
|
30
|
-
- [**Installing the package**](
|
30
|
+
- [**Installing the package**](#installing-the-package)
|
31
|
+
- [**How to build the SDK**](#How-to-build-the-SDK)
|
32
|
+
- [**Usage in Chrome Extensions**](#usage-in-chrome-extensions)
|
33
|
+
- [**Usage in Serverless Runtimes**](#usage-in-serverless-runtimes)
|
31
34
|
|
32
|
-
##
|
35
|
+
## Installing the package
|
33
36
|
|
34
37
|
To install the package via npm, run the following command:
|
35
38
|
|
@@ -39,15 +42,59 @@ npm install @rudderstack/analytics-js --save
|
|
39
42
|
|
40
43
|
**Note that this NPM module is only meant to be used for a browser installation**. If you want to integrate RudderStack with your Node.js application, refer to the [**RudderStack Node.js repository**](https://github.com/rudderlabs/rudder-sdk-node).
|
41
44
|
|
45
|
+
### Available exports
|
46
|
+
|
47
|
+
Default export will fetch the plugins during runtime as federated modules in separate requests.
|
48
|
+
|
49
|
+
```javascript
|
50
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js';
|
51
|
+
|
52
|
+
const analytics = new RudderAnalytics();
|
53
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
54
|
+
window.rudderanalytics = analytics;
|
55
|
+
```
|
56
|
+
|
57
|
+
Bundled export will contain the plugins code as part of the bundle in build time.
|
58
|
+
|
59
|
+
```javascript
|
60
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js/bundled';
|
61
|
+
|
62
|
+
const analytics = new RudderAnalytics();
|
63
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
64
|
+
window.rudderanalytics = analytics;
|
65
|
+
```
|
66
|
+
|
67
|
+
Legacy export will contain the plugins code as part of the bundle in build time and support legacy browsers like IE11.
|
68
|
+
|
69
|
+
```javascript
|
70
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js/legacy';
|
71
|
+
|
72
|
+
const analytics = new RudderAnalytics();
|
73
|
+
analytics.load(<WRITE_KEY>, <DATA_PLANE_URL>);
|
74
|
+
window.rudderanalytics = analytics;
|
75
|
+
```
|
76
|
+
|
77
|
+
## How to build the SDK
|
78
|
+
|
79
|
+
Look for run scripts in the `package.json` file for getting the browser minified and non-minified builds. The builds are
|
80
|
+
updated in the `dist` folder of the directory. Among the others, some of the important ones are:
|
81
|
+
|
82
|
+
- `npm run build:browser:modern`: This outputs **dist/cdn/modern** folder that contains the cdn package contents.
|
83
|
+
- `npm run build:npm`: This outputs **dist/npm** folder that contains the npm package contents.
|
84
|
+
|
42
85
|
## Usage in Chrome Extensions
|
43
86
|
|
44
|
-
RudderStack JS SDK can be used
|
87
|
+
RudderStack JS SDK can be used in Chrome Extensions with manifest v3, both as a content script (via the JavaScript SDK package)
|
88
|
+
or as a background script service worker (via the [service worker package](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker)).
|
89
|
+
|
90
|
+
For examples and specific details look into [Chrome Extensions Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/chrome-extension/USAGE.md)
|
45
91
|
|
46
|
-
|
92
|
+
## Usage in Serverless Runtimes
|
47
93
|
|
48
|
-
|
94
|
+
RudderStack JS SDK [service worker](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker) can be used
|
95
|
+
in serverless runtimes like Cloudflare Workers or Vercel Edge functions.
|
49
96
|
|
50
|
-
|
97
|
+
For examples and specific details look into:
|
51
98
|
|
52
|
-
|
53
|
-
|
99
|
+
- [Vercel Edge Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|
100
|
+
- [Cloudflare Worker Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|