@datarangers/sdk-javascript 0.0.1 → 0.0.3-lite
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/README.md +10 -10
- package/core/es/index.min.js +1 -1
- package/core/lib/index.min.js +1 -1
- package/es/index.min.js +1 -1
- package/lib/index.min.js +1 -1
- package/package.json +4 -1
- package/es/index-base.min.js +0 -1
- package/es/plugin/ab.js +0 -1
- package/es/plugin/autotrack.js +0 -1
- package/es/plugin/duration.js +0 -1
- package/es/plugin/route.js +0 -1
- package/es/plugin/stay.js +0 -1
- package/es/plugin/store.js +0 -1
- package/lib/index-base.min.js +0 -1
- package/lib/plugin/ab.js +0 -1
- package/lib/plugin/autotrack.js +0 -1
- package/lib/plugin/duration.js +0 -1
- package/lib/plugin/route.js +0 -1
- package/lib/plugin/stay.js +0 -1
- package/lib/plugin/store.js +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
English | [简体中文](./README.zh-CN.md)
|
|
2
2
|
|
|
3
3
|
# `DataRangers SDK - javascript`
|
|
4
|
+
|
|
4
5
|
## Sample
|
|
5
6
|
|
|
6
7
|
```javascript
|
|
7
|
-
npm install
|
|
8
|
+
npm install
|
|
8
9
|
npm run build
|
|
9
10
|
```
|
|
10
11
|
|
|
@@ -13,28 +14,27 @@ npm run build
|
|
|
13
14
|
### 1. Initialize the SDK in your javascript file
|
|
14
15
|
|
|
15
16
|
```javascript
|
|
16
|
-
const SDK = require(
|
|
17
|
+
const SDK = require("@datarangers/sdk-javascript");
|
|
17
18
|
|
|
18
19
|
SDK.init({
|
|
19
20
|
app_id: 1234, // Replace it with the "APP_ID"
|
|
20
|
-
channel:
|
|
21
|
+
channel: "cn", // Replace it with your report channel
|
|
21
22
|
log: true, // Whether to print the log
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
SDK.config({
|
|
25
|
-
username:
|
|
26
|
+
username: "xxx", // when you want report username with event
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
SDK.start(); // Setup complete and now events can be sent.
|
|
29
|
-
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
### 2. Report custom user behavior events
|
|
33
33
|
|
|
34
34
|
```javascript
|
|
35
35
|
// Take reporting the "video clicked" behavior of users for example
|
|
36
|
-
SDK.event(
|
|
37
|
-
title:
|
|
36
|
+
SDK.event("play_video", {
|
|
37
|
+
title: "Here is the video title",
|
|
38
38
|
});
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ SDK.event('play_video', {
|
|
|
42
42
|
|
|
43
43
|
```javascript
|
|
44
44
|
// Set "user_unique_id" after a user logs in and the user's unique identifier is retrieved.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
SDK.config({
|
|
46
|
+
user_unique_id: "zhangsan", // Unique user identifier
|
|
47
|
+
});
|
|
48
48
|
```
|