Add page speed analytics, stop googlebot-image from ruining site hits
--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -5,6 +5,7 @@
function googleAnalyticsGetImageUrl()
{
global $GA_ACCOUNT, $GA_PIXEL;
+ //if (stristr($_SERVER['HTTP_USER_AGENT'], 'Googlebot') return "";
$url = "";
$url.= $GA_PIXEL . "?";
$url.= "utmac=" . $GA_ACCOUNT;
@@ -187,6 +188,7 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-22173039-1']);
_gaq.push(['_trackPageview']);
+ _gaq.push(['_trackPageLoadTime']);
</script>";
echo '</head>
<body>
--- a/robots.txt
+++ b/robots.txt
@@ -1,4 +1,6 @@
User-agent: *
Allow: /
+User-agent: *
+Disallow: /lib/ga.php
sitemap: http://bus.lambdacomplex.org/sitemap.xml.php
--- a/sitemap.xml.php
+++ b/sitemap.xml.php
@@ -8,19 +8,15 @@
foreach (scandir("./") as $file) {
if (strpos($file,".php") !== false && $file != "index.php" && $file != "sitemap.xml.php") echo " <url><loc>".curPageURL()."$file</loc><priority>0.3</priority></url>\n";
}
-$url = $APIurl . "/json/stops";
-$stops = json_decode(getPage($url));
-foreach ($stops as $stop) {
- echo " <url><loc>".curPageURL()."stop.php?stopid=".htmlspecialchars ($stop[0])."</loc>";
+foreach (getStops() as $stop) {
+ echo " <url><loc>".curPageURL()."stop.php?stopid=".htmlspecialchars ($stop["stop_id"])."</loc>";
echo "<lastmod>" . $last_updated . "</lastmod>";
echo "<changefreq>monthly</changefreq>";
echo "<priority>0.9</priority>";
echo "</url>\n";
}
-$url = $APIurl . "/json/routes";
-$routes = json_decode(getPage($url));
-foreach ($routes as $route) {
- echo " <url><loc>".curPageURL()."trip.php?routeid=".htmlspecialchars ($route[0])."</loc>";
+foreach (getRoutes() as $route) {
+ echo " <url><loc>".curPageURL()."trip.php?routeid=".htmlspecialchars ($route["route_id"])."</loc>";
echo "<lastmod>" . $last_updated . "</lastmod>";
echo "<changefreq>monthly</changefreq>";
echo "<priority>0.9</priority>";