|
2 年之前 | |
---|---|---|
.changeset | 3 年之前 | |
.github | 3 年之前 | |
docs | 2 年之前 | |
packages | 2 年之前 | |
play | 2 年之前 | |
.eslintignore | 3 年之前 | |
.eslintrc.js | 3 年之前 | |
.gitignore | 3 年之前 | |
.prettierrc | 3 年之前 | |
LICENSE | 3 年之前 | |
README.md | 2 年之前 | |
package.json | 2 年之前 | |
pnpm-lock.yaml | 2 年之前 | |
pnpm-workspace.yaml | 3 年之前 | |
renovate.json | 3 年之前 | |
tsconfig.build.json | 3 年之前 | |
tsconfig.json | 3 年之前 |
medici,美地奇,指 Lorenzo Medici,洛伦佐·美第奇,美地奇家族 文艺复兴时伟大收藏家,亦是现代最大收集/收藏的家族之一。
内置,取 XHR header, userAgent,os, deviceInfo, navigator,location, navigator.connection 等封装。
1.普通 es 引包
import * as medici from '@medici/web';
medici.init({
platform: 'web',
appId: '7b5958d5-1ae6-4ad5-8a87-5fc8a4b92999',
endPoint: 'http://192.168.0.186:3000/api/collect', //服务器
trackEndPoint: 'http://192.168.0.186:3000/api/track',
stopTrack: false, //可选 是否开始追踪
config: {
user: 'testUser', //配置要track当前用户
version: '1', //配置要track当前版本
},
});
2.小程序 es
import * as medici from '@medici/miniApp';
medici.init({
url: 'xxxxxx/tracking/log/save',
config: {
user: 'xxxxxx',
version: 'xxxxxxxx', //client version
},
});
3.其他 amd 或源引入
<script src="xxx/xxxx/medici-amd.js"></script>;
medici.init({
url: 'xxxxxx/tracking/log/save',
config: {
user: 'xxxxxx',
version: 'xxxxxxxx', //client version
},
});
隐藏带上 SDK version
medici.setConfig({
...
})
medici.stop();
medici.resume();
简单的 key:value, 影射页面采集
主业务事件:event
const res = await medici.track("BuyProduct", {
event:"click",
ProductName: "MacBook Pro",
ProductPrice: 123.45,
IsAddedToFav: false,
... // 其他自定业务字段
});
开始,主要对接,init startTime,大部分参数等, maxWaitTime 是默认 30s,如果超过这个时间没有冲正 endTrack 的提示 warning.
medici.startTrack("BuyProduct", {
event:"click",
maxWaitTime: 30000, //可自定义,主要是下载等行为耗时。
ProductName: "MacBook Pro",
ProductPrice: 123.45,
IsAddedToFav: false,
... // 其他自定业务字段
});
结束 ,init endTime, 后补参数
medici.endTrack("BuyProduct", {
... // 后补参数
});
名称 | 类型 | 是否必须 | 默认值 | 备注 |
---|---|---|---|---|
traceId | string | 必须 | 业务串联码 | |
requestType | string | 必须 | 业务:BUSINESS(默认);心跳:HEARTBEAT | |
channel | string | 必须 | 渠道,例如四维看看,指房宝 | |
userId | string | 非必须 | ||
time | string | 非必须 | 请求时间戳 | |
requestUrl | string | 非必须 | ||
requestData | string | 非必须 | 请求数据 ,xhr request data | |
TrackingType | string | 非必须 | 埋点类型,前端:FRONT(默认),后端:BACKEND | |
srcPageUrl | string | 必须 | 发起请求页面 (location) | |
actionType | string | 必须 | ||
actionName | string | 必须 | ||
userIP | string | 非必须 | ||
userIpAdress | string | 非必须 | ||
userAgent | string | 必须 | UA | |
networkType | string | 必须 | ||
requestId | string | 非必须 | ||
duration | string | 非必须 | ||
result | string | 非必须 | ||
endTime | string | 非必须 | 请求结束时间 |