We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
前端埋点收集到的数据需要上报给服务端,目前较为常用的方案为三种。
通过 img 标签
function sendByImg(src, data) { var img = document.createElement("img"); img.src = `${src}?log=${data}`; }
通过 Image 对象
function sendByImage(src) { var img = new Image(); img.src = `${src}?log=${data}`; }
优点:
缺点
navigator.sendBeacon(url, data);
缺点:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
埋点方案
数据指标上报方式
前端埋点收集到的数据需要上报给服务端,目前较为常用的方案为三种。
1. 动态创建img标签,通过src发出请求
通过 img 标签
通过 Image 对象
优点:
缺点
2. ajax/fetch
优点:
缺点:
3. navigator.sendBeacon
优点:
缺点:
混合式埋点上报方案
The text was updated successfully, but these errors were encountered: