Automatically add Google Analytics to your footer
It should be noted that using Google’s Asynchronous Analytics code (triggers analytics reporting via javascript) is a much preferred option because it does its reporting in the background without hampering page load speeds. If however you need to use the standard method of inserting Google Analtyics, then here’s a quick tip to insert the analytics code into your site’s footer:
// add google analytics to footer
function add_google_analytics() {
echo '<script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>';
echo '<script type="text/javascript">';
echo 'var pageTracker = _gat._getTracker("UA-XXXXX-X");';
echo 'pageTracker._trackPageview();';
echo '</script>';
}
add_action('wp_footer', 'add_google_analytics');
Remember to change UA-XXXXX-X to your own analytics ID.
Enjoy!



goddd you really suck