DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

I like to use Google Analytics, but the boring stuff is that when you switch themes, you’ll have to re-insert the code in the new theme. To avoid it, let’s use the power of WordPress hook to insert our analytics code without editing theme files.

Just insert the following code into your functions.php file, and you’re done. Don’t forget to paste your Google Analytics code on line 5.

add_action('wp_footer', 'ga');

function ga() { ?>
    // Paste your Google Analytics code here 
<?php } ?>

Have you checked out the new Headway theme for WordPress? It is pretty cool. You can read a review here.

Leave a Comment

Your email address will not be published. Required fields are marked *