Fork me on GitHub

stats count trouble  Bottom

  • Hi, I'd develop a visit count block using the pn_counter table, but I has the trouble than every time an user click's a module this value (total hits) change, although the time of session has not finished, I'd solved this trouble adding this code at modules\Stats\ pnuserapi.php -> stats_userapi_collect:

    Code

    // [Modification by Karman] Fix count bug making a new session var...
        if (!SecurityUtil::checkPermission('::','::',ACCESS_ADMIN)&&
    !isset($_SESSION['_PNSession']['StatCounter'])&&
    !isset($GLOBALS['_PNSession']['StatCounter'])){
            $_SESSION['_PNSession']['StatCounter'] = true;
            $GLOBALS['_PNSession']['StatCounter']= true;
        }else{
            return;
        }


    But I don't know if it is the best solution? any suggest?

    --
    -. Karman .-
    http://www.inexinferis.co.nr
    PD: Excuse my English, I am learning... xD
  • Sessions, are not the solution. Security variables change sessions times limits. A session can remain open indefinitely, and a guest may not use a session at all.

    --
    David Pahl
    Zikula Support Team
  • Yes, I thought that, but what other way are?



    --
    -. Karman .-
    http://www.inexinferis.co.nr
    PD: Excuse my English, I am learning... xD
  • Well, what exactly do you want to calculate?

    What should trigger a +1 ? What do you want your formula to be?

    Why not use a script that counts unique IPs per X hours...


    --
    David Pahl
    Zikula Support Team
  • AmmoDump

    Well, what exactly do you want to calculate?

    There is not a calc. It's only add each visit to a variable (SQL)...

    AmmoDump

    What should trigger a +1 ? What do you want your formula to be?

    The question was, way pnStats increments the number of visits when a user visit a module (downloads for example), the number of visits should be incremented only the first time the user load the pag.

    AmmoDump

    Why not use a script that counts unique IPs per X hours...

    Is not for hour what I want, but the total number of visits... you can see how it's in the left side of my web... below is the address...

    Regards


    --
    -. Karman .-
    http://www.inexinferis.co.nr
    PD: Excuse my English, I am learning... xD
  • Yes, but what makes a visit a unique visit?

    You really have to decide what make a visit unique. It is rather arbitrary, if you ask me. The only thing hit counter count is the number of times it adds 1. :)

    Same with the stats, if the stats add 1 every time a module is refreshed, that gives an accurate account of how often the module is refreshed... nothing more. Throw in some Ajax, and you got some more worthless data. :P

    If you want better data, use webalyiser or sew google into your site...

    --
    David Pahl
    Zikula Support Team
  • 0 users

This list is based on users active over the last 60 minutes.