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:

AWStats browser section showing Chrome as its own browser

Your rating: None Average: 3 (1 vote)

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.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <embed> <object> <param> <strike> <caption>
  • Lines and paragraphs break automatically.

More information about formatting options