Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 谷歌分析安装混乱_Php_Wordpress_Google Analytics - Fatal编程技术网

Php 谷歌分析安装混乱

Php 谷歌分析安装混乱,php,wordpress,google-analytics,Php,Wordpress,Google Analytics,我正试图在一个新的WordPress网站(PHP)上安装GA。从“跟踪代码”一节中,我明白他们需要紧跟开头标签。已安装,状态为“未安装跟踪”。从状态“了解更多”按钮中,我了解到它需要在标记之前。我已确认状态仍然为“未安装跟踪” 有趣的是,当我检查GA数据时,我确实看到了谁访问了该网站,但没有看到chrome用户 标签“>标签“> 下面是我在body标记中查看源代码时得到的代码 <body class="page page-id-8 page-template-default" items

我正试图在一个新的WordPress网站(PHP)上安装GA。从“跟踪代码”一节中,我明白他们需要紧跟开头标签。已安装,状态为“未安装跟踪”。从状态“了解更多”按钮中,我了解到它需要在标记之前。我已确认状态仍然为“未安装跟踪”

有趣的是,当我检查GA数据时,我确实看到了谁访问了该网站,但没有看到chrome用户

标签“>标签“>

下面是我在body标记中查看源代码时得到的代码

 <body class="page page-id-8 page-template-default" itemscope itemtype="http://schema.org/WebPage">
  <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','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-0000000-1', 'example.com');
  ga('send', 'pageview');

 </script> 

    <header class="tc-header clearfix row-fluid" role="banner">

(函数(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]| |函数(){
(i[r].q=i[r].q | |[]).push(参数)},i[r].l=1*新日期();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(窗口,文档,“脚本”,“www.google-analytics.com/analytics.js”,“ga”);
ga('create','UA-0000000-1','example.com');
ga(‘发送’、‘页面浏览’);
下面是我在head标记中查看源代码时得到的代码

 <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
        <title></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="profile" href="http://gmpg.org/xfn/11" />

      <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','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-0000000-1', 'example.com');
  ga('send', 'pageview');

</script>

(函数(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]| |函数(){
(i[r].q=i[r].q | |[]).push(参数)},i[r].l=1*新日期();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(窗口,文档,“脚本”,“www.google-analytics.com/analytics.js”,“ga”);
ga('create','UA-0000000-1','example.com');
ga(‘发送’、‘页面浏览’);

使用php版本与仅将标准跟踪代码粘贴到标题模板中没有任何区别


如果您对WordPress不够熟悉,无法编辑该模板,我建议您使用Google Analytics插件。有很多。

我最近也有这个问题。需要一段时间才能显示其跟踪数据。要测试它是否工作,可以做的一件事是检查实时报告。如果在您访问站点时显示访问,则代码安装正确。

因此,只需将标准跟踪代码粘贴到标题模板中即可。我现在再次尝试了此操作,但仍然没有选择是否已安装。当您查看站点时,您能在查看源代码时看到跟踪代码吗?那么它工作正常。给谷歌一点时间来更新状态。我也这么想。。现在已经超过24小时了,它只在我从safari或firefox进入网站时显示,而在使用chrome时不显示