https://github.com/volcengine/datarangers-sdk-javascript
火山引擎数据官方 Web JavaScript 埋点 SDK,用于 Web 端和 H5 端的数据采集埋点 。使用原生 JavaScript 实现代码埋点、全埋点、AB实验、网页热力图等功能。
https://github.com/volcengine/datarangers-sdk-javascript
Last synced: about 1 year ago
JSON representation
火山引擎数据官方 Web JavaScript 埋点 SDK,用于 Web 端和 H5 端的数据采集埋点 。使用原生 JavaScript 实现代码埋点、全埋点、AB实验、网页热力图等功能。
- Host: GitHub
- URL: https://github.com/volcengine/datarangers-sdk-javascript
- Owner: volcengine
- License: other
- Created: 2022-08-10T03:58:31.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-02T06:21:37.000Z (about 2 years ago)
- Last Synced: 2024-04-02T07:34:15.054Z (about 2 years ago)
- Language: TypeScript
- Size: 289 KB
- Stars: 16
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
English | [简体中文](./README.zh-CN.md)
# `DataRangers SDK - javascript`
## Sample
```javascript
npm install
npm run build
```
## Sample
### 1. Initialize the SDK in your javascript file
```javascript
const SDK = require('@datarangers/sdk-javascript');
SDK.init({
app_id: 1234, // Replace it with the "APP_ID"
channel: 'cn', // Replace it with your report channel
log: true, // Whether to print the log
});
SDK.config({
username: 'xxx', // when you want report username with event
});
SDK.start(); // Setup complete and now events can be sent.
```
### 2. Report custom user behavior events
```javascript
// Take reporting the "video clicked" behavior of users for example
SDK.event('play_video', {
title: 'Here is the video title',
});
```
### 3. Report the unique identifier of the currently logged in user
```javascript
// Set "user_unique_id" after a user logs in and the user's unique identifier is retrieved.
SDK.config({
user_unique_id: 'zhangsan', // Unique user identifier
});
```