rudder-sdk-js 2.42.4 → 2.43.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -0
- package/README.md +35 -16
- package/dist/npm/index.cjs.js +1 -1
- package/dist/npm/index.es.js +1 -1
- package/dist/npm/index.js +1 -1
- package/package.json +4 -20
- package/dist/npm/service-worker/index.d.ts +0 -220
- package/dist/npm/service-worker/index.es.js +0 -1
- package/dist/npm/service-worker/index.js +0 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [2.43.0](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.42.4...rudder-sdk-js@2.43.0) (2023-10-16)
|
6
|
+
|
7
|
+
### Dependency Updates
|
8
|
+
|
9
|
+
* `@rudderstack/analytics-js-common` updated to version `3.0.0-beta.11`
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* **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))
|
14
|
+
|
5
15
|
## [2.42.4](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.42.3...rudder-sdk-js@2.42.4) (2023-10-02)
|
6
16
|
|
7
17
|
|
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 JavaScript SDK
|
23
23
|
|
24
24
|
The JavaScript SDK lets you track customer event data from your website and send it to your specified destinations via RudderStack.
|
25
25
|
|
@@ -27,12 +27,14 @@ The JavaScript SDK lets you track customer event data from your website and send
|
|
27
27
|
|
28
28
|
## Table of Contents
|
29
29
|
|
30
|
-
- [**Installing the JavaScript SDK**](
|
31
|
-
- [**Identifying your users**](
|
32
|
-
- [**Tracking user actions**](
|
33
|
-
- [**The `ready` API**](
|
34
|
-
- [**Self-hosted control plane**](
|
35
|
-
- [**Adding your own integrations**](
|
30
|
+
- [**Installing the JavaScript SDK**](#installing-the-javascript-sdk)
|
31
|
+
- [**Identifying your users**](#identifying-users)
|
32
|
+
- [**Tracking user actions**](#tracking-user-actions)
|
33
|
+
- [**The `ready` API**](#the-ready-api)
|
34
|
+
- [**Self-hosted control plane**](#self-hosted-control-plane)
|
35
|
+
- [**Adding your own integrations**](#adding-your-own-integrations)
|
36
|
+
- [**Usage in Chrome Extensions**](#usage-in-chrome-extensions)
|
37
|
+
- [**Usage in Serverless Runtimes**](#usage-in-serverless-runtimes)
|
36
38
|
|
37
39
|
| **IMPORTANT**: We have deprecated the service worker export from RudderStack JavaScript SDK npm package and decoupled it to a new package. <br/>If you still wish to use it for your project, refer to [**@rudderstack/analytics-js-service-worker package**](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker). |
|
38
40
|
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
@@ -192,7 +194,7 @@ Refer to the following projects for a detailed walk-through of the above steps:
|
|
192
194
|
|
193
195
|
> If the SDK does not work on the browser versions that you are targeting, verify if adding the browser polyfills to your application solves the issue.
|
194
196
|
|
195
|
-
##
|
197
|
+
## Identifying users
|
196
198
|
|
197
199
|
The `identify` call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc.
|
198
200
|
|
@@ -225,7 +227,7 @@ In the above example, the user-related information like the `userId` and `email`
|
|
225
227
|
|
226
228
|
For more information on how to use the `identify` call, refer to the [**JavaScript SDK documentation**](https://docs.rudderstack.com/stream-sources/rudderstack-sdk-integration-guides/rudderstack-javascript-sdk).
|
227
229
|
|
228
|
-
##
|
230
|
+
## Tracking user actions
|
229
231
|
|
230
232
|
The `track` call lets you record the customer events, i.e. the actions that they perform, along with any associated properties.
|
231
233
|
|
@@ -249,7 +251,7 @@ In the above example, the `track` method tracks the user event ‘**test track e
|
|
249
251
|
|
250
252
|
> You can use the `track` method to track various success metrics for your website like user signups, item purchases, article bookmarks, and more.
|
251
253
|
|
252
|
-
##
|
254
|
+
## The `ready` API
|
253
255
|
|
254
256
|
There are cases when you may want to tap into the features provided by the end-destination SDKs to enhance tracking and other functionalities. The JavaScript SDK exposes a `ready` API with a `callback` parameter that fires when the SDK is done initializing itself and the other third-party native SDK destinations.
|
255
257
|
|
@@ -263,7 +265,7 @@ rudderanalytics.ready(() => {
|
|
263
265
|
|
264
266
|
> For more information on the other supported methods, refer to the [**JavaScript SDK APIs**](https://docs.rudderstack.com/stream-sources/rudderstack-sdk-integration-guides/rudderstack-javascript-sdk#supported-apis).
|
265
267
|
|
266
|
-
##
|
268
|
+
## Self-Hosted control plane
|
267
269
|
|
268
270
|
If you are using a device mode destination like Heap, FullStory, etc., the JavaScript SDK needs to fetch the required configuration from the [**control plane**](https://docs.rudderstack.com/get-started/rudderstack-architecture#control-plane).
|
269
271
|
|
@@ -280,19 +282,36 @@ rudderanalytics.load(<WRITE_KEY>, <DATA_PLANE_URL>, {
|
|
280
282
|
| **For detailed technical documentation and troubleshooting guide on the RudderStack’s JavaScript SDK, check out our [docs](https://docs.rudderstack.com/stream-sources/rudderstack-sdk-integration-guides/rudderstack-javascript-sdk).** |
|
281
283
|
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
282
284
|
|
283
|
-
##
|
285
|
+
## Adding your own integrations
|
284
286
|
|
285
287
|
You can start adding integrations of your choice for sending the data through their respective web (JavaScript) SDKs.
|
286
288
|
|
287
|
-
###
|
289
|
+
### How to build the SDK
|
288
290
|
|
289
291
|
- Look for run scripts in the `package.json` file for getting the browser minified and non-minified builds. The builds are updated in the `dist` folder of the directory. Among the others, some of the important ones are:
|
290
292
|
|
291
|
-
- `npm run build:browser`: This outputs **rudder-analytics.min.js**.
|
292
|
-
- `npm run build:
|
293
|
+
- `npm run build:browser`: This outputs **dist/cdn/legacy/rudder-analytics.min.js**.
|
294
|
+
- `npm run build:package`: This outputs **dist/npm** folder that contains the npm package contents.
|
293
295
|
|
294
296
|
> We use **rollup** to build our SDKs. The configuration for it is present in `rollup-configs` folder.
|
295
297
|
|
298
|
+
## Usage in Chrome Extensions
|
299
|
+
|
300
|
+
RudderStack JS SDK can be used in Chrome Extensions with manifest v3, both as a content script (via the JavaScript SDK package)
|
301
|
+
or as a background script service worker (via the [service worker package](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker)).
|
302
|
+
|
303
|
+
For examples and specific details look into [Chrome Extensions Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/chrome-extension/USAGE.md)
|
304
|
+
|
305
|
+
## Usage in Serverless Runtimes
|
306
|
+
|
307
|
+
RudderStack JS SDK [service worker](https://www.npmjs.com/package/@rudderstack/analytics-js-service-worker) can be used
|
308
|
+
in serverless runtimes like Cloudflare Workers or Vercel Edge functions.
|
309
|
+
|
310
|
+
For examples and specific details look into:
|
311
|
+
|
312
|
+
- [Vercel Edge Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|
313
|
+
- [Cloudflare Worker Usage](https://github.com/rudderlabs/rudder-sdk-js/blob/main/examples/serverless/USAGE.md)
|
314
|
+
|
296
315
|
## Contribute
|
297
316
|
|
298
317
|
We would love to see you contribute to this project. Get more information on how to contribute [**here**](./CONTRIBUTING.md).
|