@volcengine/tls-js-sdk
v0.0.3
Published
tls js sdk
Downloads
2
Readme
TLS JS SDK
This is TLS JS SDK for browser.
TLS is short for Tinder Log Service.
Installation
npm install -S @volcengine/tls-js-sdk
Basic Usage
Import in the module file
import { WebTrackerBrowser } from '@volcengine/tls-js-sdk';
const wtb = new WebTrackerBrowser({
host: 'your host',
projectId: 'your projectId',
topicId: 'your topicId',
});
Import directly in the browser
<html>
<head></head>
<body>
<script src="path/to/tls-js-sdk/dist/tls_browser.js"></script>
<script>
const wtb = new TLS_Browser.WebTrackerBrowser({
host: 'your host',
projectId: 'your projectId',
topicId: 'your topicId',
});
</script>
</body>
</html>
API
WebTrackerBrowser
Class for web tracker in browser
import { WebTrackerBrowser } from '@volcengine/tls-js-sdk';
const wtb = new WebTrackerBrowser({
host: 'your host', // required
projectId: 'your projectId', // required
topicId: 'yourt topicId', // required
protocol: 'your protocol', // optional.The default value is https
time: 'batch log time interval', // optional.The default value is 10s.
count: 'batch log limit', // optional.The default value is 10.
source: 'log source', // optional.
});
WebTrackerBrowser instance method below.
send
send(data)
| params | description | |:--------|:-------------------------------------------------------------------------------| | data | (required) like { [index: string]: any } |
wtb.send({
key: 'value', // custom key/value
});
sendImmediate
sendImmediate(data)
| params | description | |:--------|:-------------------------------------------------------------------------------| | data | (required) like { [index: string]: any } |
wtb.sendImmediate({
key: 'value', // custom key/value
});
sendBatchLogs
sendBatchLogs(data)
| params | description | |:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------| | data | (required) like Array<Record<string, any>> |
wtb.sendBatchLogs([{ key: 'value' }]);
sendBatchLogsImmediate
sendBatchLogsImmediate(data)
| params | description | |:--------|:-----------------------------------------------------| | data | (required) like Array< Record<string, any>[]> |
wtb.sendBatchLogsImmediate([{ key: 'value' }])
Security
If you discover a potential security issue in this project, or think you may have discovered a security issue, we ask that you notify Bytedance Security via our security center or vulnerability reporting email.
Please do not create a public GitHub issue.
License
This project is licensed under the MIT License.