@datarangers/sdk-javascript 0.0.1
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/LICENSE +9 -0
- package/README.md +48 -0
- package/README.zh-CN.md +47 -0
- package/core/es/index.min.js +1 -0
- package/core/lib/index.min.js +1 -0
- package/es/index-base.min.js +1 -0
- package/es/index.min.js +1 -0
- package/es/plugin/ab.js +1 -0
- package/es/plugin/autotrack.js +1 -0
- package/es/plugin/duration.js +1 -0
- package/es/plugin/route.js +1 -0
- package/es/plugin/stay.js +1 -0
- package/es/plugin/store.js +1 -0
- package/lib/index-base.min.js +1 -0
- package/lib/index.min.js +1 -0
- package/lib/plugin/ab.js +1 -0
- package/lib/plugin/autotrack.js +1 -0
- package/lib/plugin/duration.js +1 -0
- package/lib/plugin/route.js +1 -0
- package/lib/plugin/stay.js +1 -0
- package/lib/plugin/store.js +1 -0
- package/package.json +68 -0
- package/types/types.d.ts +250 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Beijing Volcano Engine Technology Co., Ltd.
|
|
2
|
+
|
|
3
|
+
The DataRangers SDK was developed by Beijing Volcanoengine Technology Ltd. (hereinafter “Volcanoengine”). Any copyright or patent right is owned by and proprietary material of the Volcanoengine.
|
|
4
|
+
|
|
5
|
+
DataRangers SDK is available under the Volcanoengine and licensed under the commercial license. Customers can contact service@volcengine.com for commercial licensing options. Here is also a link to subscription services agreement: https://www.volcengine.com/docs/6285/69647
|
|
6
|
+
|
|
7
|
+
Without Volcanoengine's prior written permission, any use of DataRangers SDK, in particular any use for commercial purposes, is prohibited. This includes, without limitation, incorporation in a commercial product, use in a commercial service, or production of other artefacts for commercial purposes.
|
|
8
|
+
|
|
9
|
+
Without Volcanoengine's prior written permission, the DataRangers SDK may not be reproduced, modified and/or made available in any form to any third party.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
English | [简体中文](./README.zh-CN.md)
|
|
2
|
+
|
|
3
|
+
# `DataRangers SDK - javascript`
|
|
4
|
+
## Sample
|
|
5
|
+
|
|
6
|
+
```javascript
|
|
7
|
+
npm install
|
|
8
|
+
npm run build
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Sample
|
|
12
|
+
|
|
13
|
+
### 1. Initialize the SDK in your javascript file
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
const SDK = require('@datarangers/sdk-javascript');
|
|
17
|
+
|
|
18
|
+
SDK.init({
|
|
19
|
+
app_id: 1234, // Replace it with the "APP_ID"
|
|
20
|
+
channel: 'cn', // Replace it with your report channel
|
|
21
|
+
log: true, // Whether to print the log
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
SDK.config({
|
|
25
|
+
username: 'xxx', // when you want report username with event
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
SDK.start(); // Setup complete and now events can be sent.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Report custom user behavior events
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
// Take reporting the "video clicked" behavior of users for example
|
|
36
|
+
SDK.event('play_video', {
|
|
37
|
+
title: 'Here is the video title',
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 3. Report the unique identifier of the currently logged in user
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
// Set "user_unique_id" after a user logs in and the user's unique identifier is retrieved.
|
|
45
|
+
SDK.config({
|
|
46
|
+
user_unique_id: 'zhangsan', // Unique user identifier
|
|
47
|
+
});
|
|
48
|
+
```
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
简体中文 | [English](./README.md)
|
|
2
|
+
# `DataRangers SDK - Web端`
|
|
3
|
+
## 构建SDK
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
npm install
|
|
7
|
+
npm run build
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## 使用方式
|
|
11
|
+
|
|
12
|
+
### 1. 在你的js文件中初始化SDK
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
const SDK = require('@datarangers/sdk-javascript');
|
|
16
|
+
|
|
17
|
+
SDK.init({
|
|
18
|
+
app_id: 1234, // 替换成你申请的 "APP_ID"
|
|
19
|
+
channel: 'cn', // 选择你要上报的区域,cn: 国内 sg: 新加坡 va:美东
|
|
20
|
+
log: true, // 是否打印日志
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
SDK.config({
|
|
24
|
+
username: 'xxx', // 你想要上报一个username的公共属性
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
SDK.start(); // 初始化完成,事件开始上报
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. 上报自定义用户事件
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// 比如上报一个'play_video'视频播放的事件
|
|
35
|
+
SDK.event('play_video', {
|
|
36
|
+
title: 'Here is the video title',
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. 使用当前登录用户的信息做为唯一标识来进行上报
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// 可以在用户登录后获取带有唯一性的标识来设置给user_unique_id
|
|
44
|
+
SDK.config({
|
|
45
|
+
user_unique_id: 'zhangsan', // 用户唯一标识,可以是你的系统登录用户id
|
|
46
|
+
});
|
|
47
|
+
```
|