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

AWStats, hits on images
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.

7 Responses to “Hits on Images”

  1. Drax says:

    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!

  2. Jean-Luc says:

    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.

  3. Drax says:

    Thanks a lot for your answer!! that little detail solved my problems… now it works!

    Thanks again!

  4. ChojinDSL says:

    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/

  5. Jean-Luc says:

    Try this:

    ExtraSectionFirstColumnValues1=”URL,^(\/images\/.*\.(png|gif|jpe?g))$”

    It will only count the images under /images.

  6. Nico says:

    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

  7. Jean-Luc says:

    You need to use URLWITHQUERY in the extra section:

    ExtraSectionCondition1=”URLWITHQUERY,^\/download\.php\?archivo\=\w+\.mp3$”

    ExtraSectionFirstColumnValues1=”URLWITHQUERY,^\/download\.php\?archivo\=(\w+)\.mp3$”


 

Leave a Reply