How to add Google Analytics to your website

Now that you've gained access to your new Google Analytics account, you need to set up your website profile, get your JavaScript code to add to your website pages, and you're good to go!

 

Setting up a website profile
To set up a website profile, click this link:
add website profile

On the profile adding page, you simply need to:

  • Leave the first option as is: "Add a Profile for a new domain"
  • Enter your domain name in the "Please provide the URL of the site you would like to track." field. This will most likely be in the www.yourdomain.com format.
  • Optionally, you'll need to adjust your timezone settings, if you're anywhere other than GMT -8. This is important for your reporting.

Once you click Finish>, your site is now installed and ready to be tracked, and you're taken the the Tracking Status page. You should see the following message:

Tracking Not Installed (Last checked: 2007-06-21 12:51 PM PST.)
The Google Analytics tracking code has not been detected on your website's home page. For Analytics to function, you or your web administrator must add the code to each page of your website.

Installing the Google Analytics Tracking Code

At the bottom of the Tracking Status page, there is a text box with 6 lines of code, that looks like this:

<script type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-230985-8";
urchinTracker();
</script>

Copy that code. You need to install it at the bottom of each of the web pages on your website (the reason it should be at the bottom is so that you're tracking people who are fully loading the pages, not just hopping on/off your site). You will do this by inserting it into the HTML, right above the tag.

If you are using templates or include files, it's as simple as adding this to the footer of your site, and it should now be installed across your entire site.

However, if your site is basic HTML, and there are too many pages to open them all up manually, then you'll want to find an easier way. (As far as I'm concerned, any more than 2 pages is enough to justify some level of automation!) This is where a global "Find & Replace" tool will be your best friend. I'll use the example of Dreamweaver:

  1. Use the Find & Replace tool (Ctrl + F)
  2. Select "Find in: Folder...", and select the folder that contains your website files
  3. In the "Find:" field, type </body>
  4. In the "Replace:" field, paste the JavaScript code from Google Analytics, and type </body> on the line after it
  5. Make sure the "Match case" option is unchecked
  6. Click Replace All, and answer Yes when prompted.

Dreamweaver will now find all your </body> tags, and insert the Google Analytics code before it. Once it's done, simply upload the HTML files to your web host, and the code is installed!

After a short time, the Check Status page will now say "Receiving data". However, it will still take up to 24 hours to see your first reports.

Add comment


Security code
Refresh

TOP RANKING

Top 3 ranking position, Guaranteed! find out more >>

SEARCH SUPEREMACY

Maximum visibility in Google, Yahoo & Bing! find out more >>

YOUR REPUTATION PACKAGE

Image is everything! Manage yours. find out more >>

THE PERFORMANCE PACKAGE

Tracking leads & revenue? Pay for profit. find out more >>

TOTAL INTERNET DOMINATION

Reign Supreme On the Internet. find out more >>