You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
需求描述
自己之前只是以最原始的方式给各个网站的前端页面添加了 CNZZ 统计代码,还有很多可以改进的地方,初步罗列如下:
关于上面列出的第一项,CNZZ 统计代码用的是下面这种形式,最终会生成文字链接。但是由于 Chrome 的安全设置,会在浏览器控制台中出现第二段的提示代码,也就是说只有统计功能,但并不会显示文字连接。为了安全起见,还是需要在 CSS 中设置好样式,隐藏 CNZZ 统计内容。
方案调研
Google Analytics 与国内各家统计服务的对比
CNZZ 统计原理
cnzz 统计 原理
自己编写 JS 插件 / NPM 包
(write OR build OR publish) npm package
现成的库/组件
应用过程
参考了 import和export用法总结 和 raychenfj/vue-uweb,把函数写在
addcnzz.js
中:然后在 vue-cli 中用
import
指令引用它,最后在需要的地方,调用AddCnzz()
函数就可以了。要点总结
写一个自己的工具函数其实很简单嘛!
The text was updated successfully, but these errors were encountered: