Google Analytics event tracking
[busui.git] / include / common.inc.php
blob:a/include/common.inc.php -> blob:b/include/common.inc.php
--- a/include/common.inc.php
+++ b/include/common.inc.php
@@ -59,11 +59,18 @@
 			}
 		}
 	}
+	if ($_SESSION['lat'] != "" && isMetricsOn()) {
+		trackEvent("Geolocation","Updated Location", "Geocoded - ".($geocoded ? "Yes" : "No"));
+	}
 }
 debug(print_r($_SESSION, true) , "session");
 function isDebugServer()
 {
 	return $_SERVER['SERVER_NAME'] == "10.0.1.154" || $_SERVER['SERVER_NAME'] == "localhost" || $_SERVER['SERVER_NAME'] == "127.0.0.1" || !$_SERVER['SERVER_NAME'];
+}
+function isAnalyticsOn()
+{
+	return !isDebugServer();
 }
 function isDebug($debugReason = "other")
 {