Tutorial- How to Add Analytics to Your Website

Tutorial- How to Add Analytics to Your Website

Whether you have one website or one thousand, you need Google Analytics. Here is a quick tutorial for installing Google Analytics on your website or WordPress blog.

Getting the code:
1. Go to http://www.google.com/analytics/index.html.
2. Sign in or create a new account. Setting up a new account is fast and simple; you just need a valid email address.
3. Add a New Domain. To do this, you simply need to add your URL, set your country and time zone, and hit Finish.
4. Copy the code. After selecting Finish, you will be redirected to a new webpage. This webpage contains the magical code that makes everything happen. Don’t worry about the different tabs; the page will open to the proper code for you. Simply place your cursor inside the box containing your code, press “Control A” to select all, then “Control C” to copy the code. (On a Mac, press “Command A” and “Command C.”)

You now have your Google Analytics code. You need to put your code somewhere you can access it. Open Word, Notepad or any other text editor and paste (“Control V” or “Command V”) your code into a new file. Then save the file as “Analytics” and place it on your desktop.

Placing the code on your webpage:
1. Open the index.html file for your website. You will need to access your server with an FTP program like FileZilla. Download the index file to your desktop. Then open the file with any text editor (such as Dreamweaver).
2. Scroll to the bottom of the file and look for the closing “/body” and “/html” tags. You need to paste your Google Analytics code directly above these two tags. Get your code from the file you saved it in. Copy and paste the code into your index file. DO NOT place the code below these tags or it will not work.
3. Save the index file and upload it to your server. You will want to overwrite the old file if it asks.
4. Go back to http://www.google.com/analytics/index.html. If you still have the page open, you can simply press the Finish button and Google will automatically check to see if you installed the code. Once Google says it worked, you will need to go back and add the code to every page you want to track.

Placing the code in a WordPress blog:

1. Open your WordPress admin page.
2. Go to Themes / Edit Themes.
3. Look to the right side of the text box and click on footer.php. This will open the footer.php file in a text editor so you can add the code.
4. Scroll to the bottom of the file and look for two specific tags: and . You want to paste your Google Analytics code directly above these two tags. Go get your code from the file you saved it in. Copy and paste the code.
5. Click Update File.
6. Go back to http://www.google.com/analytics/index.html. If you still have the page open, you can simply press the Finish button and Google will automatically check to see if you installed the code. In a WordPress blog, you will not need to add the code to any of the other files. The footer.php is coded so that it is already added to every page found in the blog.

You have everything in place to start learning about your web traffic. Simply log in to Google Analytics every day to view your results.


2 Responses to “Tutorial- How to Add Analytics to Your Website”


By: Kinderhook
July 29th, 2010 at 5:59 pm

Good article, but the code you wanted to post doesn’t show up.  Here’s the line:
“2. Scroll to the bottom of the file and look for two specific tags; and .”
This site read the code as code, and not as text to display.  I’ve run into the same problem myself, and end up adding symbols, such as “+…”  after the “<” and before the rest of the code, which make the code unreadable as HTML.


Sarah Beek
By: Sarah Beek
July 29th, 2010 at 9:04 pm

Wow, thanks for the catch, and the tip! I fixed it, I ended up using quotation marks, but thanks!

Leave a Reply