Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Finding Out Who’s Viewing Your Web Pages 645

23


If you do get access to these raw log files, you’ll most likely see a whole lot of lines that
look something like the following. (I’ve broken this one up into two lines so that it fits on
the page.)


vide-gate.coventry.ac.uk - - [17/Feb/2015:12:36:51 -0700]
"GET /index.html HTTP/1.0" 200 8916


What does this information mean? The first part of the line is the site that accessed the
file. (In this case, it was a site from the United Kingdom.) The two dashes are used for
authentication. (If you have login names and passwords set up, the username of the per-
son who logged in and the group that person belonged to will appear here.) The date and
time the page was accessed appear inside the brackets. The next part is the actual file-
name that was accessed; here it’s the index.html at the top level of the server. The GET
part is the actual HTTP command the browser used; you usually see GET here. Finally,
the last two numbers are the HTTP status code and the number of bytes transferred. The
status code can be one of many things: 200 means the file was found and transferred cor-
rectly; 404 means the file was not found. (Yes, it’s the status code you get when pages
aren’t found in your browser.) Finally, the number of bytes transferred usually will be the
same number of bytes in your actual file; if it’s a smaller number, the visitor interrupted
the load in the middle.


Most web hosts provide log processing software that will take the logs generated by the
server when users visit your site and turn them into reports, often with graphs and other
visual aids, that you can use to easily see how many users are visiting your site as well as
how those servers are finding your site, whether it’s through search engines or links on
other web pages. You’ll want to check out the support site for your web host to determine
how to set things up so that your logs are processed and find out the URL of the reports
that are generated.


Google Analytics


There are other ways to keep track of who’s visiting your site and what pages they’re
viewing. 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 log files.
Google Analytics works by providing you with a code that uniquely identifies your site.
On each of the pages that you want to track, you include a reference to a JavaScript file
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.

Free download pdf