if-wolftrack
v1.0.4
Published
埋点程序
Downloads
6
Readme
WolfTrack
原名wolf-logger 更名为wolf-track
Deps 依赖
if-ua
, if-spm
window.WolfConfig
在调用程序前请先配置该设置
window.WolfConfig = {
spm: { a: "default", b: "main" },
pv: {
where_to_sendpv: "//xiaoheizhang.cn/prod.gif",
where_to_record: '//127.0.0.1/a.gif',
PV_TO_URLS: [
["127.0.0.1", "local"],
["localhost", "local"],
["dev", "dev"],
["test", "test"],
["uat", "uat"],
],
},
}
简单配置即可使用
<script>
var SITE_APP_ID = 'P011'
var LOGSITE = '埋点数据接收地址'
var WolfConfig = { spm: { a: SITE_APP_ID, b: "main" }, pv: { p_id: SITE_APP_ID, application: '4', where_to_sendpv: LOGSITE[0]}, is_auto_pv: true, spa: true };
(function () {
var wf = document.createElement("script");
wf.src = "//if-fe-assets.oss-cn-beijing.aliyuncs.com/pkg/if-wolftrack/1.0.2/if-wolftrack.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
window.WolfTrack
初始化
const wolf = new WolfTrack()
sendPV
发送PV信息
const config = {
method: 'POST'
}, data = {foo: 'Hi,World'}
wolf.sendPV(config, data)
record
主动上报
const data = {foo: 'Hi,World'}
wolf.record(data)
版本
- 1.0.4 PV字段支持动态获取(函数)
- 1.0.3 移除了FingerPrint指纹算法,使用了更为简单高效的uuid的算法,打包后体积45KB