The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

number of visits on cpanel home page

Discussion in 'cPanel Developers' started by premsai, Apr 21, 2009.

  1. premsai

    premsai Member

    Joined:
    Oct 21, 2003
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 :)
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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.
     
  3. premsai

    premsai Member

    Joined:
    Oct 21, 2003
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 ?
     
    #3 premsai, Apr 22, 2009
    Last edited: Apr 22, 2009
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    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.
     
  5. premsai

    premsai Member

    Joined:
    Oct 21, 2003
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    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 :)
     

Share This Page