谷歌分析php网站?

谷歌分析php网站?,php,google-analytics,Php,Google Analytics,我有一些问题,让谷歌分析工作。我有一个analyticsTracking.php文件,它包含在我的index.php页面中,如下所示: <?php include("begin.php"); include($subroot . "templateconfig.php"); include($cms['tngpath'] . "genlib.php"); include($cms['tngpath'] . "getlang.php"); include($cms['tngpath'] .

我有一些问题,让谷歌分析工作。我有一个analyticsTracking.php文件,它包含在我的index.php页面中,如下所示:

<?php
include("begin.php");
include($subroot . "templateconfig.php");
include($cms['tngpath'] . "genlib.php");
include($cms['tngpath'] . "getlang.php");
include($cms['tngpath'] . "$mylanguage/text.php");
tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;
include($cms['tngpath'] . "checklogin.php");

//Insert the following lines in your index.php to take advantage of template switching
if($templateswitching && $templatenum) {
include($cms['tngpath'] . "templates/template$templatenum/index.php");
exit;
}
//end of lines to be inserted for template switching

$flags['noicons'] = true;
$flags['noheader'] = true;
tng_header( $text['mnuheader'], $flags );
?>

<!-- "Home Page" (the text for these messages can be found at near the bottom of text.php -->
<h1><?php echo $text['mnuheader']; ?></h1>



<p><strong>Please customize this page!</strong></p> 

<?php include ("analyticsTracking.php"); ?>
</body>
</html>
<script type="text/javascript">
var gaJsHost = ((" https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script> <?php
// End Analytics tracking code
?>

请自定义此页面

查看Generated index.html时,analyticsTracking.php中根本没有数据?为什么?

请注意,我不使用PHP,所以所有这些对我来说都是新的

Edit1:对不起,我使用的是index.php而不是index.html

Edit2:analyticsTracking.php包含如下内容:

<?php
include("begin.php");
include($subroot . "templateconfig.php");
include($cms['tngpath'] . "genlib.php");
include($cms['tngpath'] . "getlang.php");
include($cms['tngpath'] . "$mylanguage/text.php");
tng_db_connect($database_host,$database_name,$database_username,$database_password) or exit;
include($cms['tngpath'] . "checklogin.php");

//Insert the following lines in your index.php to take advantage of template switching
if($templateswitching && $templatenum) {
include($cms['tngpath'] . "templates/template$templatenum/index.php");
exit;
}
//end of lines to be inserted for template switching

$flags['noicons'] = true;
$flags['noheader'] = true;
tng_header( $text['mnuheader'], $flags );
?>

<!-- "Home Page" (the text for these messages can be found at near the bottom of text.php -->
<h1><?php echo $text['mnuheader']; ?></h1>



<p><strong>Please customize this page!</strong></p> 

<?php include ("analyticsTracking.php"); ?>
</body>
</html>
<script type="text/javascript">
var gaJsHost = ((" https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script> <?php
// End Analytics tracking code
?>

var gaJsHost=((“https:==document.location.protocol)?”https://ssl." : "http://www.");
write(unescape(“%3Cscript src=”+gaJsHost+“google analytics.com/ga.js”type='text/javascript'%3E%3C/script%3E”);
试一试{
var pageTracker=_gat._getTracker(“UA-xxxxxx-x”);
页面跟踪器。_trackPageview();
}捕获(错误){}

因此,如果我理解正确,您的index.php脚本包括analyticsTracking.php,但是当您在浏览器中查看index.php时,您看不到analyticsTracking.php中的任何HTML

<?php include ("analyticsTracking.php"); ?>


这条路对吗?analyticsTracking.php是否与index.php位于同一目录中?尝试将include更改为require,查看刷新网页时是否打印错误。

抱歉,问题是我使用了错误的php文件。它正常工作。

analyticsTracking.php包含什么?生成的
index.html
?您正在使用PHP,但没有使用它。如果Google Analytics脚本没有加载到您的页面中,您希望它如何运行?@Blender>对不起,我使用index.php。这一切对我来说都很好(除了
包含
之间的空格(
)-尽管这只是我个人的偏好。当您打开错误时,会得到什么?
错误报告(E\u all);