Reporting Chrome usage via AWStats
AWStats is a great tool to analyze your Apache logs. Unless you've been living under a rock, there's a new browser in town - Chrome. Until you tell AWStats how to break it out for you, you won't see any statistics for it. Read on for how to modify AWStats so that it can detect the Chrome browser.
I'm assuming that $AWSTATS_HOME is the root of where you installed AWStats
First, let's fetch the favicon so it can be displayed all pretty:
wget http://www.google.com/tools/dlpage/res/chrome/images/chrome-16.png \ -O $AWSTATS_HOME/wwwroot/icon/browser/chrome.png
Now, let's edit our perl module file. Now, because the Chrome UserAgent shows up like so:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13
we need to make sure that we check for the word 'Chrome' before we look for Mozilla, AppleWebKit, and Safari.
Fire up your favorite text editor, and open the file $AWSTATS/wwwroot/cgi-bin/lib/browsers.pm. Find the line that looks like:
@BrowsersSearchIDOrder = (
Now, scroll down until you find the next occurence of
'safari',
on its own line. Insert this line just above it:
'chrome',
Next, find this:
%BrowsersHashIDLib = ( # Common web browsers text
and add the following text immediately after it.
'chrome','Chrome',
Now to set up the beautiful icon -- find this:
%BrowsersHashIcon = ( # Standard web browsers
and add the following text immediately after it.
'chrome','chrome',
We're done! Now save the file, and either wait for your next normal log parse run, or fire one off manually. After that, you should see something similar to the following:

Comments
[...] Het zal waarschijnlijk
[...] Het zal waarschijnlijk niemand ontgaan zijn, Google heeft een eigen browser ontwikkeld. Voor de statistieken van mijn websites gebruik ik Awstats. Nu heeft deze standaard nog geen herkenning voor Chrome, maar dit is op te lossen met een paar kleine aanpassingen. [...]
[...] Report Chrome in
[...] Report Chrome in AWstats [...]
[...] el uso del nuevo
[...] el uso del nuevo navegador de Google, Chorme. Investigando un poco por ahí, he encontrado cómo hacer que lo haga. Adjunto un resumen, adaptado para instalaciones [...]
Very easy. Nice write
Very easy. Nice write up.
Thanks.
Thanks!
Very helpful! Thanks for the great tip.
Awesome write up on how to
Awesome write up on how to display chrome in awstats
What to do if you don't have CLI access to the server?
I have a site hosted on Cox Small Business servers. How would I go about making these changes (I'm guessing in an .htaccess file) for AWStats since I don't have CLI access to the server or its installation locations? I've run into similar problems with customizing PHP. Every tip or tutorial assumes you have full access and control over the server. Am I missing something, or is it just everyone but me has this sort of control and access on servers they don't own or operate?
Thanks for any help you can offer.
Add new comment