awstats

How to track jpg hits as page views in awstats 7.0


I've setup awstats to read cloudfront log files and I need to be able to generate reports for hits on specific files, which are images used for banners. I changed "NotPageList" options to exclude the image files and I deleted the awstats*.txt data files and ran a fresh -update but the jpg images are still not counted as pages. What do I need to do to get this working?

LogFile="/var/log/cloudfront-logs/mydomain.log"
LogFormat="%time2 %cluster %bytesd %host %method %virtualname %url %code %referer %ua %query"
LogSeparator="\t"
SiteDomain="d2fxxxxxx.cloudfront.net"
HostAliases="d2fxxxxxx.cloudfront.net"
NotPageList="css js class bmp ico rss xml swf"
DecodeUA=1

Solution

  • Looks like there is an additional criteria for a request to be a "page" determined by mime type in awstats which is not documented.. So, to fix this for my local install I hacked the code to remove this mime type test.

    AWStats 7.0 build 1.971 awstats.pl line 18219

    Before:

    if ( $NotPageList{$extension} ||
    ($MimeHashLib{$extension}[1]) && $MimeHashLib{$extension}[1] ne 'p') { $PageBool = 0;}
    

    After:

    if ( $NotPageList{$extension} ) { $PageBool = 0;}