Skip to content

Instantly share code, notes, and snippets.

@ceejayoz
Created August 24, 2009 14:54
Show Gist options
  • Save ceejayoz/173917 to your computer and use it in GitHub Desktop.
Save ceejayoz/173917 to your computer and use it in GitHub Desktop.
<?php
function google_analytics() {
print "<script type=\"text/javascript\">\n";
print "var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n";
print "document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n";
print "</script>\n";
print "<script type=\"text/javascript\">\n";
print "var pageTracker = _gat._getTracker(\"UA-2899761-10\");\n";
print "pageTracker._initData();\n";
print "pageTracker._trackPageview();\n";
print "</script>\n";
}
add_action('wp_footer', 'google_analytics');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment