Skip to main content
 首页 » 编程设计

google-analytics之Google Analytics 无法在 000webhost.com 上运行

2025年05月04日151txw1958

我创建了一个 single HTML使用以下代码在公共(public) HTML 文件夹中的文件。

我无法在 Analytics 上查看任何单个访问者。我试过以下:

  • 将分析代码转移到正文标签
  • 等待 2 天完成设置。仍然没有结果
  • 按照以下答案的建议删除了任何“/”。

  • 任何帮助,将不胜感激。提前致谢。

    <!DOCTYPE html> 
    <html> 
     
    <head> 
      <title>Jamku Stats</title> 
     
      <script> 
        (function(i, s, o, g, r, a, m) { 
          i['GoogleAnalyticsObject'] = r; 
          i[r] = i[r] || function() { 
            (i[r].q = i[r].q || []).push(arguments) 
          }, i[r].l = 1 * new Date(); 
          a = s.createElement(o), 
            m = s.getElementsByTagName(o)[0]; 
          a.async = 1; 
          a.src = g; 
          m.parentNode.insertBefore(a, m) 
        })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 
     
        ga('create', 'UA-30294621-11', 'auto'); 
        ga('send', 'pageview'); 
      </script> 
     
    </head> 
     
    <body> 
     
      <p>Server is up and running</p> 
     
    </body> 
     
    </html>

    请您参考如下方法:

    尝试删除转义引号 \ (等待两天是正确的,因为非高级 Universal Analytics 最多需要 48 小时来计算数据。

    这是没有转义引号的代码:

    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
          })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); 
     
          ga('create', 'UA-1000000-11', 'auto'); 
          ga('send', 'pageview');