PDA

View Full Version : Google tracking code in php page


hmobley
01-24-2008, 06:03 AM
is the following a valid include code to add this to my phpmotion page

<body>
<?php

<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">
var pageTracker = _gat._getTracker("UA-3361177-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>
?>






</body>

davidj
01-24-2008, 10:43 AM
you dont have any PHP in that page!

????

hmobley
01-24-2008, 02:55 PM
this is not the page in question, I want to add google analytics to my phpmotion page, when i add just the script it does not show, their instructions indicate using a common include for php.

davidj
01-24-2008, 03:04 PM
whats the name of the php page your wanting to include

do you have a PHP environment setup to handle the include

hmobley
01-24-2008, 03:23 PM
sure, site is www.petplanetvideos.com (http://www.petplanetvideos.com), and I was putting this code on main1 and main2.php which main 1 is the index page.

davidj
01-24-2008, 06:04 PM
This is how to include files using the php method

include("main2.php");