Hits on Images
AWStats reports include a standard list of hits on the web site pages. The web site pages are all URL’s ending with .htm, .html, .php, .asp,… Images and multimedia contents are not pages.
If images are important in your web site, you need to know which images are the most shown.
This extra section lists the most popular images of your web site.
You can add the Extra Section below at the end of your awstats.your-domain-name.conf configuration file.
New Report
This AWStats screen has been simulated for better readability.
Extra Section
ExtraSectionName1="Hits on Images"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,\.(png|gif|jpe?g)$"
ExtraSectionFirstColumnTitle1="Image"
ExtraSectionFirstColumnValues1="URL,^(\/.*\.(png|gif|jpe?g))$"
ExtraSectionFirstColumnFormat1="<A HREF='http://www.your_site.com%s' TARGET='_blank'>%s</A>"
ExtraSectionStatTypes1=HBL
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=10
MinHitExtra1=1
Replace www.your_site.com by the address of your site.
MaxNbOfExtra1 is the number of lines that will be listed. Use the most convenient value.
March 20th, 2007 at 7:07 pm
I added that extra section in my awstats.your-domain-name.conf but I dont get any data on the reports… the new fields are shown in the stats but they are all empty… all other normal fields of awstats updates normally.
Do I have to chenge something on the Apache logs or what?
Thanks a lot and this is a very usefull site 😉 congratulations!
March 20th, 2007 at 9:30 pm
I copied the section in an AWStats config file and I got the same result as you! This was caused by WordPress replacing my " (quotation mark) by ” (right double quotation mark) and my ' (apostrophe) by ‘ (left single quotation mark).
I have found a work-around and I just updated the extra section accordingly. You should now be able to copy it and paste it in your AWStats config file without problem.
March 21st, 2007 at 2:36 pm
Thanks a lot for your answer!! that little detail solved my problems… now it works!
Thanks again!
October 6th, 2007 at 10:07 am
Hi there. I’ve noticed that your ExtraSection config parses ALL images on the server. This is including those which AWstats uses as icons to display for its statistics.
(Im a total noob when it comes to regexp)
Is there an easy way to restrict the image statistics to a specific subdirectory (include all subdirectories benath it)?
e.g./var/www/example.com/images/
and this would include all subdirectories such as:
/var/www/example.com/images/old/
/var/www/example.com/images/new/
/var/www/example.com/images/photshopped/
October 6th, 2007 at 10:19 am
Try this:
ExtraSectionFirstColumnValues1=”URL,^(\/images\/.*\.(png|gif|jpe?g))$”
It will only count the images under /images.
October 31st, 2007 at 1:29 pm
Hi Jean-Luc, I am trying to add to my ExtraSection a filter that contain only mp3 download files, but I cant.
the url that appear in my log is like this:
GET /download.php?archivo=file.mp3
I just added the URLWithQuery=1 in my cfg file, but nothing appear in my extra section
How can I do it?
Thanks
October 31st, 2007 at 1:44 pm
You need to use URLWITHQUERY in the extra section:
ExtraSectionCondition1=”URLWITHQUERY,^\/download\.php\?archivo\=\w+\.mp3$”
…
ExtraSectionFirstColumnValues1=”URLWITHQUERY,^\/download\.php\?archivo\=(\w+)\.mp3$”
October 23rd, 2008 at 4:39 pm
Jean-Luc
Must commend you on some terrific code.
Pasted it into awstat and it worked just as promised.
It tracks all images in a specific folder/entire site.
Is it possible to use the same code to track hits on specific images served?
Would like to have it track multiple images to supply advertisers with a monthly report on number of times their image appeared on the site.
Thanks again
Courtney
November 19th, 2008 at 5:11 am
I’m having a bit of trouble with the code. While I get a new section ‘Hits on Images’ the results come back as URLs. Not images – any ideas?
Question moved to our forum about Extra Sections: trouble with ‘Hits on Images’.
June 23rd, 2009 at 3:14 am
Hi! Nice 🙂 I tried adding the extra section as you’ve instructed, and the new fields are shown in the stat.. (which are blank) and after 1 day when awstat updates, the ‘hits on image’ fields disappear.
Any idea?
July 1st, 2009 at 2:03 pm
Hi,
That can happen in systems using cPanel. Have a look at Changing Config File in cPanel. The article explains several possible work-arounds.
July 15th, 2009 at 4:10 am
You saved me a lot of work here, friend!
I’ve been googling for days to find a solution, and now (05:08 in the night/morning) I thought I’d just give it one more shot before sleep, and found this. I was just about to give up.
I’ll try that part with only counting images in a subfolder tomorrow. Great stuff.
Works exactly as promised, can’t thank you enough!
September 20th, 2009 at 11:58 am
hi,
thank you very much it works! but how can i see the whole list? like in my sites-section – i can see the whole list and can filter!
thx
September 20th, 2009 at 12:11 pm
me again. i want to see all .zip and .rar files!
_________________________________
# Extra Section for all file types
ExtraSectionName1=”Hits on Files”
ExtraSectionCodeFilter1=”200 304″
ExtraSectionCondition1=”URL,\.(rar|zip)$”
ExtraSectionFirstColumnTitle1=”File”
ExtraSectionFirstColumnValues1=”URL,^(\/.*\.(rar|zip))$”
ExtraSectionFirstColumnFormat1=”%s”
ExtraSectionStatTypes1=PL
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=120
MinHitExtra1=1
_______________________________
it doesnt work 😐 why? i see only all images!
September 21st, 2009 at 8:37 pm
ok now it works thx 😀
December 1st, 2009 at 4:51 pm
Searching for how to view the hits on all of my images files using AWSTATS. This configuration did the trick…thx so much for the information!
January 14th, 2010 at 11:54 am
I used this code snippet for showing the top images, as-is, only changing the domain name as needed, but the images area does not show up in my web stats generated by AWSTATS.
is there something I need to do to make it show up besides insert that code block in the bottom of the file?
January 14th, 2010 at 12:31 pm
Never mind my earlier post… was running 6.6.x version of AWSTATS and had to upgrade to the latest and now it looks like it will work.
July 22nd, 2010 at 6:36 pm
Tried the MP3 variation of the above code ideas, and have a major disparity to understand.
The numbers reported for ‘hits’ vs. ‘pages viewed’… Before investigating the extra section, I decided to remove both MP3 and XML file extensions from the ‘NotPageList’… The numbers I get for Page Views is very different.
(…)
Question moved to our forum about Extra Sections: major disparity when counting hits on MP3 and XML files.