Domain Investing & Website Development

Domaining site recommended by Domaining.com

AWStats for All Domains

Michael Sumner • Aug 17, 2009 • 5 Comments

I came across a limitation of AWStats today that, much to my surprise, has not really been addressed effectively.  For those of you that have cPanel and AWStats installed on your server, and host multiple domains on the same box, you may have noticed this too.  The way you normally see your AWStats is to log into cPanel, click on AWStats, and then it brings you to a list of all the domains you host on that server.  You then click on a single domain to view the traffic stats.

However, if you want to quickly get a glimpse of the traffic across your entire network of sites (maybe to give to prospective advertisers or investors), your only option is to click on each domain individually and create a spreadsheet.  There is one script I found called AWStats Totals, but it seems to assume your AWStats directory is in a public_html (or www) folder that can be viewed directly.  In most cases, AWStats is installed in a directory below that, and you can only access the logs from cPanel.  Also, it seems insanely hard to configure.

So after searching for the better part of an hour to find a script that would work for my hosting configuration, I decided it would be quicker to just write one myself.  You start out by selecting a month and a year.  It then logs into your cPanel to get a list of all “addon domains”, then logs in to the stats pages one at a time, collects the information, and then displays it on the screen with totals at the bottom.  I’m not sure how many setups this will work on, but you should be fine if you have cPanel on the x3 theme, and a current version of AWStats.

Configuration is very simple, just enter your cPanel username and password, and your primary domain name, and you’re good to go.

Hope this helps someone…

PHP script to view stats for all domains combined in AWStats.

5 Responses to AWStats for All Domains

  1. ChristyK says:

    This could be just what I’m looking for. But I don’t understand what to do with it. Where do I upload the script? If I upload to the main domain directory, it just prints out the code when I load the page. Thanks for sharing!

  2. Michael Sumner says:

    Christy, it shouldn’t matter where you upload the script since it is just faking a login to your CPanel and collecting the stats for all the different domains on your hosting. If it is just printing out the code, it sounds like you don’t have PHP installed on your hosting account.

  3. ChristyK says:

    Thanks for very quick reply :) No, I definitely have php. Hosting is with Hostgator and I have a ton of WordPress sites (thus the desire for this script). I’ll see what I can figure out.

  4. Michael Sumner says:

    Hmm, just a thought, did you accidentally save it as .phps instead of .php? That’s the only other thing I can think of.

  5. ChristyK says:

    IThe code kept getting changed when I downloaded or saved directly from here. So I just copied the code as it showed up on the screen, pasted and saved as php file again and all is well. I put it into a password protected directory just to be safe since you don’t have to log in to see the stats. Definitely serves well for the short term. Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>