number of visits on cpanel home page

premsai

Member
Oct 21, 2003
12
0
151
india
I'm trying to customize my cpanel ! I want to display a minimal stats on cpanel home page, something like :

Yesterday : NN visits
This Month : NN visits
Last Month : NN visits

Anyone aware of any hooks or cpanel variables that i can use to grab this info ?

Any help will be greatly appreciable :)
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
I'm trying to customize my cpanel ! I want to display a minimal stats on cpanel home page, something like :

Yesterday : NN visits
This Month : NN visits
Last Month : NN visits

Anyone aware of any hooks or cpanel variables that i can use to grab this info ?

Any help will be greatly appreciable :)
cPanel/WHM itself does not track this information. The statistics information you see in cPanel is generated by those individual statistics programs, which get their information from the Apache web server logs, rather than cPanel/WHM itself. As a result, there are no cPanel APIs or hooks to retrieve this information for you.

You could build a script to process the files generated by the statistics programs (stored in ~/tmp/awstats, ~/tmp/analog and ~/tmp/webalizer) to gather that information and store each item in a plain text file. You can then use a cPanel branding tag to insert the data from the text file into the cPanel interface.

Let me know if you need help with the branding tags.
 

premsai

Member
Oct 21, 2003
12
0
151
india
Thank you for the hint David .. i got the script ready to fetch and write the necessary fields into a text file under /home/user/tmp.

Format is like :
---
xx yy zz
---

where xx,yy & zz are numeric figures ( number of visits - yesterday, this month & last month ).

Can you give me the exact cpanel branding tag to insert the stats content ?
 
Last edited:

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Thank you for the hint David .. i got the script ready to fetch and write the necessary fields into a text file under /home/user/tmp.

Format is like :
---
xx yy zz
---

where xx,yy & zz are numeric figures ( number of visits - yesterday, this month & last month ).

Can you give me the exact cpanel branding tag to insert the stats content ?
Here it is:

Code:
<cpanel Branding="text(filename)">
Where filename is the name of the file stored in ~/reseller/cpanelbranding/theme/style/

~/reseller is your home directory as a reseller
theme is x3 (unless you're using another theme)
style is the name of the branding style you are customizing.

This will take the text or HTML that is in that text file and place it in the cPanel interface.
 

premsai

Member
Oct 21, 2003
12
0
151
india
I modified the script to save the stats in html format under user's webalizer directory. Now i can directly include the file as below :

Code:
<cpanel include="$homedir/tmp/webalizer/visits.html">
Thanks for all the help :)