Google Analytics makes it easy for you to track how many vistors visit your website and how they reached your website: Direct (they remembered your website address), Referral (they followed a link from another website), and Search Engine Results (including the search terms the visitors used to find your site).
Google Analytics is free. Just sign up for an account at http://www.google.com/analytics/.
It’s easy too: just copy and paste the code they give you into your WordPress theme. This tutorial will show you how.
Step 1: Create an Account for your Website
1. Log in at http://www.google.com/analytics/.
2. Click on Add new account
3. Click no the Sign Up button
Fill out the New Account Signup form and click on the Continue button
Enter your Name and Country information and click on the Continue button.
Agree to the terms and conditions and click on the Create New Account button.
Select the code from <script to </script> with your mouse button. You can also do this by clicking once in code box and using the keystroke combination CTRL-C. Click on the Save and Finish button.
Most premium themes contain a box where you can paste your code. This is very convenient because you don’t have to make changes to your theme’s files. Consult your theme’s documentation to find the area, click inside the box, and Edit | Paste the code (can also use the keystroke combination CTRL-V).
If your theme doesn’t contain an area to add your tracking code, you’ll have to edit the theme’s Footer file. From your WordPress dashboard, click on Appearance | Editor.
Some code will appear in the text box in the center of the screen, but that’s not the file we want. Click on Footer (footer.php) from the file listing on the right hand side. The Footer code will be loaded into the center box. Scroll down to the very bottom of the file.
Important: Editing your theme files can break your theme and keep you from accessing your website. Make sure you have good backups of the footer.php file before you proceed.
You want to paste the code, using Edit | Paste or the keystrokes CTRL-V, directly before the </body> tag. Click on the Save button.
Wait a few minutes and the status triangle should change from yellow to green. You’re done.
Great post David! There is a great plugin that is a timesaver for tasks like these called All-in-One Webmaster. All you have to do is add the UA Google code. No need to go into your theme files. You can also use it to submit Alexa, Yahoo Site Explore, Get Clicky, Google Webmaster site verifications and codes, plus much more.
Plugins like this can be good. I prefer avoiding the plugin overhead and pasted the code in myself, but I haven’t had to do that lately because most of the premium themes I use Catalyst, Genesis, Woothemes, etc. include a box in the theme’s dashboard where you can paste the code. No plugins required.
Hi again,
I have Genesis and AgentPress. Where do you put the code? In the theme settings where it says: Header/Footer scripts? I have always ignored that section
Well, I guess that’s another great reason to LOVE Genesis, which I do!
Yep, just paste the code in the footer scripts box for those premium themes (you can put more than one script there).
I also use the Agent Press theme and was wondering where to put the analytics code. What did you mean by “in the footer scripts box.” I went into the editor section but just wasn’t sure where to actually paste the analytics code.
AgentPress is a StudioPress theme that uses the Genesis framework. In your WordPress dashboard, select Genesis | Theme Settings. Scroll down and you’ll find separate boxes for header and footer scripts.