Google Analytics script execution should be deferred
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Currently GA script executes asynchronously while page is loading without a good reason for doing so since there are no custom GA events being tracked when page load is happening or right after it finishes, it's also showing up in Lighthouse score report as a very small main-thread blocker. Performance-wise it would be better to defer the script execution until the page has finished loading
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位页面加载期间使用的 Google Analytics 集成。确认其当前的异步行为,然后验证脚本是否延迟到页面加载完成后执行,并确认 Lighthouse 不再将其报告为主线程阻塞因素。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- performance, web-dev
- Issue 类型
- 重构
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100