vue H5火山引擎埋点

对应文章:火山引擎

初始化放在public下index.html:

引用sdk:
<script async src="https://lf3-data.volccdn.com/obj/data-static/log-sdk/collect/5.0/collect-rangers-v5.1.3.js"></script>
(function(win, export_obj) {
     win['LogAnalyticsObject'] = export_obj;
     if (!win[export_obj]) {
         function _collect() {
             _collect.q.push(arguments);
         }
         _collect.q = _collect.q || [];
         win[export_obj] = _collect;                
     }
    win[export_obj].l = +new Date();
})(window, 'collectEvent');

window.collectEvent('init', {
   app_id: app_id, // 参考2.1节获取,注意类型是number而非字符串
   channel: 'cn', // 设置数据上送地址
   log: true, // true:开启日志,false:关闭日志
   autotrack: false // 全埋点开关,true开启,false关闭
});
// 此处可添加设置uuid、设置公共属性等代码
window.collectEvent('start'); // 通知SDK设置完毕,可以真正开始发送事件了

在这里插入图片描述
这样就表示初始化成功了
在需要的页面埋点就可以了

示例:
window.collectEvent('event', {
   key_string: 'value_string',
   key_int: 10
});

猜你喜欢

转载自blog.csdn.net/qq_43384836/article/details/127668774