百度+google
百度比较快,google功能全帮我分析..
- <!– Global site tag (gtag.js) – Google Analytics –>
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-11111111-1"></script>
- <script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag(‘js’, new Date());
- gtag(‘config’, ‘UA-111111111-1’);
- </script>
复制代码
- //Baidu
- <script>
- var _hmt = _hmt || [];
- (function() {
- var hm = document.createElement("script");
- hm.src = "https://hm.baidu.com/hm.js?11111111111";
- var s = document.getElementsByTagName("script")[0];
- s.parentNode.insertBefore(hm, s);
- })();
- </script>
复制代码
请问我要该怎么整合到一个 JS 里面去,
怎么改。求助大佬。
西藏网友:不要用单独的js调用统计
四川网友:可能记录不全吗
湖北网友:写在一个js文件里不就是在一起了?
重庆网友:引用x.js
- document.writeln("<!– Global site tag (gtag.js) – Google Analytics –>");
- document.writeln("<script async src=\’https://www.googletagmanager.com/gtag/js?id=UA-11111111-1\’></script>");
- document.writeln("<script>");
- document.writeln(" window.dataLayer = window.dataLayer || [];");
- document.writeln(" function gtag(){dataLayer.push(arguments);}");
- document.writeln(" gtag(\’js\’, new Date());");
- document.writeln("");
- document.writeln(" gtag(\’config\’, \’UA-111111111-1\’);");
- document.writeln("</script>");
- document.writeln("<script>");
- document.writeln("var _hmt = _hmt || [];");
- document.writeln("(function() {");
- document.writeln(" var hm = document.createElement(\’script\’);");
- document.writeln(" hm.src = \’https://hm.baidu.com/hm.js?11111111111\’;");
- document.writeln(" var s = document.getElementsByTagName(\’script\’)[0]; ");
- document.writeln(" s.parentNode.insertBefore(hm, s);");
- document.writeln("})();");
- document.writeln("</script>");
复制代码
http://tool.chinaz.com/tools/html_js.aspx
澳门网友:看起来不是很规范
01-18 00:22