未找到Google Analytics文件 [英] Google Analytics file not found
问题描述
我正尝试在我的网站中使用Google Analytics。我直接从Google Analytics网站复制了代码,并按照说明将其嵌入到HTML中。
这是我的代码:
< script>
函数(b,o,i,l,e,r){b.GoogleAnalyticsObject = l; b [l] ||(b [l] =
function(){(b [l ] .q = b [l] .q || [])。push(arguments)}); b [l] .l = + new Date;
e = o.createElement(i); r = o。 getElementsByTagName(i)[0];
e.src ='// www.google-analytics.com/analytics.js'; //这是文件
r.parentNode.insertBefore(e, R)} ...(窗口,文件, '脚本', 'GA'));
ga('create','not give out'); ga('send','pageview');
< / script>
当我使用这个脚本加载我的页面时,需要几秒钟的时间。没有脚本,它几乎立即加载。这是我知道问题出在Google Analytics代码中的方式。
在页面最终加载后出现以下错误消息:
无法加载资源:net :: ERR_FILE_NOT_FOUND
如何让这个档案或脚本正常运作? 我发现,如果你从开头( 我希望以后遇到这个问题的人都会发现这有帮助。 I am trying to use Google Analytics in my site. I copied the code directly from the Google Analytics website and followed the instructions for embedding it into my HTML. Here is my code: When I load my page with this script, it takes a number of seconds. Without the script, it loads practically instantly. This is how I know the problem is in the Google Analytics code. The following error message appears after the page finally loads: After some further investigation, the file not found is from How can I get this file or script to work correctly? I found out that if you remove the I hope anyone with this problem in the future finds this helpful. 这篇关于未找到Google Analytics文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
<经过一些进一步调查,找不到的文件来自第5行<
e.src
)删除 //
,请求就起作用。
< script>
函数(b,o,i,l,e,r){b.GoogleAnalyticsObject = l; b [l] ||(b [l] =
function(){(b [l ] .q = b [l] .q || [])。push(arguments)}); b [l] .l = + new Date;
e = o.createElement(i); r = o。 getElementsByTagName(i)[0];
e.src ='www.google-analytics.com/ analytics.js'; //正斜线取出
r.parentNode.insertBefore(e,r) }(窗口,文件, '脚本', 'GA'));
ga('create','not give out'); ga('send','pageview');
< / script>
<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js'; // this is the file
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','not giving this out');ga('send','pageview');
</script>
Failed to load resource: net::ERR_FILE_NOT_FOUND
e.src='//www.google-analytics.com/analytics.js'
on line 5.//
from the beginning (e.src
), the request works.<script>
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='www.google-analytics.com/analytics.js'; // forward slashes taken out
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','not giving this out');ga('send','pageview');
</script>