diff --git a/system/config.ini b/system/config.ini index 8ac10b6..ecf1561 100644 --- a/system/config.ini +++ b/system/config.ini @@ -26,6 +26,9 @@ disqus.shortname = "" ; Google publisher google.publisher = "" +; Google analytics +google.analytics.id = "" + ; Pagination, RSS, and JSON posts.perpage = "5" tag.perpage = "10" diff --git a/system/includes/functions.php b/system/includes/functions.php index 4b59824..864126e 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -600,6 +600,26 @@ function publisher(){ } } +// Google Analytics +function analytics(){ + $analytics = config('google.analytics.id'); + $script = << + var _gaq = _gaq || []; + _gaq.push(['_setAccount', '{$analytics}']); + _gaq.push(['_trackPageview']); + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + +EOF; + if (!empty($analytics)) { + return $script; + } +} + // Menu function menu(){ $menu = config('blog.menu'); @@ -641,4 +661,4 @@ function generate_rss($posts){ // Turn an array of posts into a JSON function generate_json($posts){ return json_encode($posts); -} \ No newline at end of file +} diff --git a/themes/default/css/style.css b/themes/default/css/style.css index c1c78db..3400d6e 100644 --- a/themes/default/css/style.css +++ b/themes/default/css/style.css @@ -41,6 +41,11 @@ img { outline: 0 none; } +.hide { + position: absolute; + top: -9999em; + left: -9999em; +} /*---------------------------- Headings -----------------------------*/ @@ -622,4 +627,4 @@ aside .copyright p{ width: 100%; } -} \ No newline at end of file +} diff --git a/themes/default/layout.html.php b/themes/default/layout.html.php index c363b47..a3c5d20 100644 --- a/themes/default/layout.html.php +++ b/themes/default/layout.html.php @@ -18,7 +18,7 @@ -
+
@@ -40,5 +40,6 @@
+ - \ No newline at end of file +