1.0.3 Statistics working erratically

Discussion in 'General Support' started by Grinfeld, Jun 3, 2014.

  1. Grinfeld

    Grinfeld Member

    Joined:
    Apr 8, 2012
    Messages:
    66
    Likes Received:
    4
    Hello to all,

    Statistics for my WeBid site were working OK.
    Suddenly they began to work erratically, some days working... some other days not working at all.
    Now they only show the statistics for 2012 and 2013 but none for 2014...

    I have the following settings for statistics and files:

    Date Format in admin: mm/dd/yyyy
    Time zone: Same in server and admin settings

    Statistics settings: activate? Yes
    Generate user access...: yes
    Generate browser and operating...: yes

    file useragent.inc.php: The last version Version 5.6.0 Copyright (C) 014-04-08
    file viewaccessstats.php: with all the changes to show the USA date format.

    Any hints to what the problem may be?

    Thanks to all.
     
  2. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Hi Grinfield, Have you tried putting the original useragent back and trying to see if it works with it?
    The new version has a few changes in it by the looks of it. I personally haven't used the webid stats for a very long time.
     
  3. Grinfeld

    Grinfeld Member

    Joined:
    Apr 8, 2012
    Messages:
    66
    Likes Received:
    4
    Hello Pani,

    I just putted back the original useragent... still does not record any stats at the data base "currentaccesses" table.

    The data base has the info for 2014 up to May 28 and then it stopped recording.... the currentaccesses table has a total of 14 pages, 30 rows each, with records for 2012, 2013 and 2014 up to May 28...

    The admin /admin/viewaccessstats.php at the CP shows, for this month of June 2014, the statistics in perfect order by month, day and year for june 2012 and 2013, but nothing for 2014.

    I just ran a test: I went to the data base and change the date of the last recording, which was May 28 2014, to June 02 2014.

    Then I went to my CP, at admin, to check what happened: it shows the June 02 2014 statistics in correct, perfect order, among the other statistics for June 2012 and 2013...

    which tells me that the problem has to do with the currentaccesses table, at the data base, not recording...

    Any hints Pani?
    Thank you for your great help,

    Mario Grinfeld
     
    Last edited: Jun 3, 2014
  4. Grinfeld

    Grinfeld Member

    Joined:
    Apr 8, 2012
    Messages:
    66
    Likes Received:
    4
    Problem solved - But something is wrong and I do not really know what it is:

    I re-name the table currentaccesses at the data base as currentaccesses_old.
    I copied the structure of it, without any data, to the same data base as currentaccesses.
    It began to record all statistics allright.
    It works now Ok, but what is the problem??? Does the table, at the data base, get saturated after a while of recording data or what???
     
  5. helios

    helios Member

    Joined:
    Sep 26, 2012
    Messages:
    43
    Likes Received:
    2
    My statistics stopped counting exactly after one year.
     
  6. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    Mine stopped working in 2013 apparently. I just noticed it recently. I will look at it later to see what the problem is.
     
  7. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    Ok, I finally had time to look at it. I compared the default admin/viewaccessstats.php with the code I had on my own Webid page. Apparently I must of changed it back in 2013. It's not making sense to me right now thought why my last recording in my database was in 2013. It says the last time I modified it was March 31, 2014.

    Here's what the difference was in MY admin/viewaccessstats.php pages.

    I had on mine on line 39:
    PHP:
    elseif ($listby == 'w')
    {
        
    $year date('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE year = " $year " ORDER BY day ASC";
        
    $statsview $MSG['827'];
        
    $statstext $MSG['828'];
    }
    else
    {
        
    $month date('m');
        
    $year date('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE month = " $month " AND year = " $year " ORDER BY day ASC";
        
    $statsview date('F Y');
        
    $statstext $MSG['109'];
    The default 1.1.1 webid code is:
    PHP:
    elseif ($listby == 'w')
    {
        
    $year gmdate('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE year = " $year " ORDER BY day ASC";
        
    $statsview $MSG['827'];
        
    $statstext $MSG['828'];
    }
    else
    {
        
    $month gmdate('m');
        
    $year gmdate('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE month = " $month " AND year = " $year " ORDER BY day ASC";
        
    $statsview gmdate('F Y');
        
    $statstext $MSG['109'];
    This should fix the problem for at least me. I thought I would let people know what I fixed in case in comes in handy down the road. I will report back if it doesn't fix my problem.
     
  8. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    I am still having an issue and I wasn't seeing any report when I look at the viewaccessstats.php page. I just found something though, I don't see anything reported under view by day/week but, I do see results when I click to view by month. Unfortunately for me, the last month I see listed is 10 /2014. The database has not been updated in a while for statistics.

    It's mainly my Access Statistics when I view my day or week that displays nothing.

    When I click on View Browser Statistics | View Platform Statistics, they seem to show good logs.

    Any help would be appreciated. Thanks!
     
  9. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    By the way, I am working with the 1.1.1 version.

    Basically no new recordings were being added to the database and that is what is causing the problem of not displaying any new recordings. That is why I see nothing for the day or the week. So, I've done some digging and was trying to figure out what happened and what page is supposed to add the daily visitor recordings to the database.

    Somehow it looks like my includes/stats.inc.php page had a code changed it on line 25. What I had there was:
    Code:
    $THISDAY    = date('d');
    $THISMONTH    = date('m');
    $THISYEAR    = date('Y');
    The default page looks like this:
    Code:
    $THISDAY    = gmdate('d');
    $THISMONTH    = gmdate('m');
    $THISYEAR    = gmdate('Y');
    I had to think why I was trying to changed those. A while ago I was trying to make it cycle on a daily time schedule where 12am was a new day. Before it was starting on a new day at around 8pm at night.

    Hopefully switching the code back to the default code on both the includes/stats.inc.php page and the admin/viewaccessstats.php helps make it work. That should be were the problem was. I am letting everyone know what happened to my code instead of just letting people hang without knowing what I did wrong. I will report back and let people know that it solved my problem or ask again if I need help.
     
  10. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    I still have problems. Can someone help me? What page and on what line of code would be the place that sends a report to record in my database? I tried replacing the admin/viewaccessstats.php code I had with the default. I replaced the admin/index.php page with the default code because I was using someone's modified code that should of had adjustments made in my database to begin with. I got to get my stats to start recording again in my database. Please help!
     
  11. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    Haven't used webid stats for a few years now. Always turn off and use 3rd party stats. I think it is using scripts which are probably now outdated on determining details of visitors
     
  12. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    I didn't realize all of the gmdate strings were changed to date. I just made the adjustment and changed them all to date. I only had a few of mine done changed to date and I guess it's possible it could of caused some issues with this stat issue.
     
  13. bgrantland

    bgrantland Donor Donor

    Joined:
    Sep 6, 2012
    Messages:
    114
    Likes Received:
    12
    I am having a problem with the statistics function which I think is related to David62311's issue above.

    I'm running 1.1.2P2 and it's working well so far, but the statistics graphs are using Greenwich Mean Time I think, because it is already tomorrow in my statistics. I think that's why they used GMdate in the includes/stats.inc.php page. A lot of the WeBid folks are in England, so this is still the default time setting. Obviously setting the time zone in the administrative back end doesn't change the statistics function.

    I remember the forum having a mod to fix the calendar when I upgraded a couple of years ago. Maybe that's where David got his code. I'm going to try it and see if it works.
     
  14. bgrantland

    bgrantland Donor Donor

    Joined:
    Sep 6, 2012
    Messages:
    114
    Likes Received:
    12
    I changed the date from GMdate to Date. It's still tomorrow on WeBid statistics. I'm not sure this function really works any more anyway, since others say it stopped working. Maybe it hasn't been upgraded to accommodate changes in the WeBid upgrades.
     
  15. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    I never got mine working. I gave up looking at it. I would like to figure out where it's supposed to get recorded. The database doesn't update because there are no new recordings.

    My Google Analytics that I have plugged into my page works just the same so, that is why I put it on the back burner.
     
  16. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    Try the original Webid 1.1.2 code for the viewaccessstats.php file. The updated one seems to screw stuff up and cause errors. I now have the 1.1.2 Webid scripts on a back page of mine and saw there was no statistics results and noticed errors. When I replaced the code, the past few days of results appeared. Here's the code to it. Give it a try.

    PHP:
    <?php
    /***************************************************************************
    *   copyright                : (C) 2008 - 2015 WeBid
    *   site                    : http://www.webidsupport.com/
    ***************************************************************************/

    /***************************************************************************
    *   This program is free software; you can redistribute it and/or modify
    *   it under the terms of the GNU General Public License as published by
    *   the Free Software Foundation; either version 2 of the License, or
    *   (at your option) any later version. Although none of the code may be
    *   sold. If you have been sold this script, get a refund.
    ***************************************************************************/

    define('InAdmin'1);
    $current_page 'stats';
    include 
    '../common.php';
    include 
    $include_path 'functions_admin.php';
    include 
    'loggedin.inc.php';

    $TOTAL_PAGEVIEWS 0;
    $TOTAL_UNIQUEVISITORS 0;
    $TOTAL_USERSESSIONS 0;

    $listby 'd';
    if (isset(
    $_GET['type']) && in_array($_GET['type'], array('d','w''m')))
    {
        
    $listby $_GET['type'];
    }

    // Retrieve data
    if ($listby == 'm')
    {
        
    $query "SELECT SUM(pageviews) as pageviews, SUM(uniquevisitors) as uniquevisitors, SUM(usersessions) as usersessions, month, year
                FROM " 
    $DBPrefix "currentaccesses GROUP BY month ORDER BY month ASC";
        
    $statsview $MSG['5281'];
        
    $statstext $MSG['5280'];
    }
    elseif (
    $listby == 'w')
    {
        
    $year gmdate('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE year = " $year " ORDER BY day ASC";
        
    $statsview $MSG['827'];
        
    $statstext $MSG['828'];
    }
    else
    {
        
    $month gmdate('m');
        
    $year gmdate('Y');
        
    $query "SELECT * FROM " $DBPrefix "currentaccesses WHERE month = " $month " AND year = " $year " ORDER BY day ASC";
        
    $statsview gmdate('F Y');
        
    $statstext $MSG['109'];
    }

    $res mysql_query($query);
    $system->check_mysql($res$query__LINE____FILE__);

    // set the arrays up
    $data_line = array();
    $data_max = array();
    $data_max[] = 0;
    while (
    $row mysql_fetch_assoc($res))
    {
        if (
    $listby == 'w')
        {
            
    $date $row['year'] . '/' $row['month'] . '/' $row['day'];
            
    $weekno date('W'strtotime($date));
            if (!isset(
    $data_line[$weekno]))
            {
                
    $data_line[$weekno] = array();
                
    $data_line[$weekno]['pageviews'] = 0;
                
    $data_line[$weekno]['uniquevisitors'] = 0;
                
    $data_line[$weekno]['usersessions'] = 0;
            }
            
    $data_line[$weekno]['pageviews'] += $row['pageviews'];
            
    $data_line[$weekno]['uniquevisitors'] += $row['uniquevisitors'];
            
    $data_line[$weekno]['usersessions'] += $row['usersessions'];
            
    $data_max[$weekno] += $row['pageviews'];
        }
        elseif (
    $listby == 'm')
        {
            
    $monthno $row['month'] . $row['year'];
            if (!isset(
    $data_line[$monthno]))
            {
                
    $data_line[$monthno] = array();
                
    $data_line[$monthno]['month'] = $row['month'];
                
    $data_line[$monthno]['year'] = $row['year'];
                
    $data_line[$monthno]['pageviews'] = 0;
                
    $data_line[$monthno]['uniquevisitors'] = 0;
                
    $data_line[$monthno]['usersessions'] = 0;
            }
            
    $data_line[$monthno]['pageviews'] += $row['pageviews'];
            
    $data_line[$monthno]['uniquevisitors'] += $row['uniquevisitors'];
            
    $data_line[$monthno]['usersessions'] += $row['usersessions'];
            
    $data_max[$monthno] += $row['pageviews'];
        }
        else
        {
            
    $data_line[] = $row;
        
    $data_max[] = $row['pageviews'];
        }
        
    $TOTAL_PAGEVIEWS += $row['pageviews'];
        
    $TOTAL_UNIQUEVISITORS += $row['uniquevisitors'];
        
    $TOTAL_USERSESSIONS += $row['usersessions'];
    }

    $MAX max($data_max);
    foreach (
    $data_line as $k => $v)
    {
        if (
    $listby == 'w')
        {
            
    $date $k;
        }
        elseif (
    $listby == 'm')
        {
            
    $date $v['month'] . '/' $v['year'];
        }
        else
        {
            
    $date $v['day'] . '/' $v['month'] . '/' $v['year'];
        }
        
    $template->assign_block_vars('sitestats', array(
                
    'DATE' => $date,
                
    'PAGEVIEWS' => $v['pageviews'],
                
    'PAGEVIEWS_WIDTH' => ($v['pageviews'] * 100) / $MAX,
                
    'UNIQUEVISITORS' => $v['uniquevisitors'],
                
    'UNIQUEVISITORS_WIDTH' => ($v['uniquevisitors'] * 100) / $MAX,
                
    'USERSESSIONS' => $v['usersessions'],
                
    'USERSESSIONS_WIDTH' => ($v['usersessions'] * 100) / $MAX
                
    ));
    }

    $template->assign_vars(array(
            
    'SITENAME' => $system->SETTINGS['sitename'],
            
    'TOTAL_PAGEVIEWS' => $TOTAL_PAGEVIEWS,
            
    'TOTAL_UNIQUEVISITORS' => $TOTAL_UNIQUEVISITORS,
            
    'TOTAL_USERSESSIONS' => $TOTAL_USERSESSIONS,
            
    'STATSMONTH' => $statsview,
            
    'STATSTEXT' => $statstext
            
    ));

    $template->set_filenames(array(
            
    'body' => 'viewaccessstats.tpl'
            
    ));
    $template->display('body');
    ?>
     
  17. bgrantland

    bgrantland Donor Donor

    Joined:
    Sep 6, 2012
    Messages:
    114
    Likes Received:
    12
    Thanks David62311! Maybe that will also fix my error log which is recording tomorrow's date. I'll check again tomorrow and if this doesn't fix the error log calendar I will post a new thread with that issue.
     
  18. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    Oh, you have a date problem. There was a bug there before. It was starting the new day at 8pm or something like that. We were working on it at one time. I don't know if that issue was ever fixed. We sometimes get sidetracked here and start working on another issue before fixing the ones we were working on.
     
  19. bgrantland

    bgrantland Donor Donor

    Joined:
    Sep 6, 2012
    Messages:
    114
    Likes Received:
    12
    I remember fixing a bug in the date function back in the WeBid version I first installed in 2012. I'll see if I kept those bug fix instructions. I think the problem with many of the bug fixes is that they are fixed in a new version, but development on the version after that sometimes starts with pages from the earlier version, and then the error is back in.
     
    nay27uk likes this.
  20. david62311

    david62311 Well-Known Member

    Joined:
    Aug 29, 2013
    Messages:
    2,165
    Likes Received:
    251
    I still got this issue. Nobody knows the answer I guess when I asked before how does the data get written up and inserted into the database.
    What does record the visitors when they come onto my site?
     

Share This Page