HTML and CSS Reference
There are other ways to keep track of who's visiting your site and what pages they're
viewing, too. Processing log files is one way to get an idea of who's visiting your site.
Another option is to use Google Analytics, a tool provided for free by Google that keeps
track of all the visitors to your site and generates reports about your visitors.
The nice thing about Google Analytics is that you don't have to deal with any log files.
Google Analytics works by providing you with a code that uniquely identifies your site.
that Google provides, and pass in the code for your site. Whenever users visit the pages
with a link to the tracking script, Google records information about their visit. Google
then uses this information to create the reports for you.
One particularly nice thing about Google Analytics is that you can usually add it to your
site even if the site is on a server you don't control. So if you create a weblog (blog) on a
site like Tumblr, you can edit the theme of the site and paste in the Google Analytics
Installing Google Analytics
To get started with installation, you'll need to go to the Google Analytics website,
http://www.google.com/analytics/ and sign up for an Analytics account. If you don't
already have a Googe account, you'll need to sign up for one, too.
After you sign up for your account, you need to create a profile for your website. Click
the Add Website Profile link on the Google Analytics home page to create the profile,
and you'll see the form in Figure 20.3.
To add a profile, you just enter the URL of your website in the form provided and choose
the time zone for your site. After you've saved your new profile, Google provides the
code to paste into your own web page so that customer visits can be tracked. The code
tracking code on your site, copy the code that Google provides into your own pages.
Google recommends that you paste the tag just inside the closing <head> tag on your
pages, but for reasons of performance, it probably makes more sense to paste it just
before the closing <body> tag. To start out, edit the HTML for your site's home page and
paste in the Google Analytics code. Upload the page to your server if necessary, and then
visit that page in your browser.
After the page has been loaded with the Google Analytics tracking code in place, Google
Analytics will indicate that it has started tracking visits to your site. At that point, add
the Google tracking code to your other pages and upload them, too.