Reputation: 15807
I have some problem to get the Google Analytics to work. I have got a analyticsTracking.php file and this is included on my index.php page like this :
<?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>
When looking on the genereted index.html there is no data from the analyticsTracking.php at all? Why?
Pleas note, I am not working with PHP so all this is new to me.
Edit1: Sorry, I am using index.php and not index.html.
Edit2: analyticsTracking.php contains somthing like this :
<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
?>
Upvotes: 1
Views: 1616
Reputation: 15807
Sorry, the problem was that I used the wrong php file. It is working as it should.
Upvotes: 1
Reputation: 2674
So if I'm understanding correctly, your index.php script includes analyticsTracking.php, yet when you view index.php in a browser, you don't see any of the HTML from analyticsTracking.php.
<?php include ("analyticsTracking.php"); ?>
Is that the correct path? Is analyticsTracking.php in the same directory as index.php? Try changing the include to a require and see if it prints an error when the webpage is refreshed.
Upvotes: 1