Adding Google Analytics Code to WordPress

Google Analytics is a Real Time site statistics online tool from Google. It helps blog owners and bloggers to easily track their site and observe how their blog is doing. After signing up for Google Analytics, Google Analytics gives you a code which you need to enter on your blog so that Google Analytics can start to track your blog.

This tutorial will guide you adding Google Analytics Code to WordPress Blog. You need to have self-hosted blog on WordPress prior to adding Google Analytics Code to your blog. Because WordPress.com hosted blogs don’t have access to FTP and since you don’t have access to your files, you cannot add the Analytics code anywhere if you don’t ave access to your header.php file. Please read the guide carefully and make sure you have access to your FTP account.

Adding Google Analytics Code in Footer

Open your FTP account and navigate to your theme directory like /wp-content/themes/your-theme/ , and open the file footer.php . You will see a bunch of code already out there in the file.

Please don’t touch any part of the code in the file otherwise it can lead your blog to error page. Just copy the Code provided to you by the Google Analytics and paste the code before </body> tag in the file. You can see the Image for reference.

Adding Google Analytics Code in Header

You can also add the Google Analytics Code in Header file too. For adding google analytics code in your wordpress blog in the header file, move to the your wordpress theme directory and open the file header.php , then copy the Google Analytics code and paste it in between the <head> </head> tags. See the Image for Reference.

Simple Google Analytics Plugin

If you are getting any problem adding the Google Analytics code in either Header or Footer, you can use Simple Google Analytics WordPress Plugin to integrate Google Analytics with your blog easily. It allows you to select whether you want to add the code in the footer or header. What you have to do is copy “UA-00000000-0” part from your code and paste it in Google Analytics ID. Click on the Sace button and you are done.

One comment

  • vikram

    Hi,

    I have a wordpress.org installation and in the header.php i don’t see any tags.

    How do i activate google analytics in such a case.

    Reply

Leave a Reply

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