Traffic and Site Access - Records data but not show stats

beegee
Posts: 7

Traffic and Site Access - Records data but not show stats

One more question please about this script: http://coursesweb.net/php-mysql/website ... ss-data_s2
I have one central page that shows the stats for the site. There are pages that I want to log but not show the stats on.
In the former version I placed a script and it tracked that page but does not show the stats itself.
I see the same script on the test.php page but when I place it on a different page it does not track it.
So how do I log a page without showing all the stats?

Admin
Hello,
Just include the "siteaccess/siteaccess.js" in the html code of that page.

Code: Select all

<script src="siteaccess/siteaccess.js"></script>
In the "siteaccess.js" file put an absolute /full path to "siteaccess.php" (with "://"), for example:

Code: Select all

ob_ajax.open('POST', 'http://localhost/siteaccess.php', true);
- Or, if the "siteaccess.php" file is directly in root of your website, you can set the path with "/" at beginning:

Code: Select all

ob_ajax.open('POST', '/siteaccess.php', true);
- You can check in browser console (F12) to see if there is JS error.

beegee
hi and first thank you again for all the work you have done on this and all your scripts

As the month changed I checked my stats. Under the top this month I see the pages visited and it does show only the pages visited this month and the amount does show the count for just this month. However when I look at the Overall top accessed pages, any pages visited this month do not show, only pages not visited this month. I did visit a page listed in overall that has not been visited this month and after a visit it shows in the current moth but disappears from the overall.

I downloaded and looked in the pgaccess.json and it appears to be storing the info correctly as I see for a page visited this month:

Code: Select all

"nrac":11,"nracm":{"2017":{"6":10,"7":1}},"dt":1498909305
For a page not visited this month I see:

Code: Select all

"nrac":14,"nracm":{"2017":{"6":14}},"dt":1498690977

Admin
I made some modifications in this script to fix the problem you mentioned.
Download again the script and replace the "class.PagesAccess.php" with the new one.

- Or, if you want to make the changes yourself, open the "class.PagesAccess.php" file, and replace this code (lines 159 .. 172):

Code: Select all

else { // gets the items with 'dt' between $first_d and $last_d $pgadata =[]; $this->num_rows = count($this->pgadata); if($this->num_rows > 0) { for($i=0; $i<$this->num_rows; $i++) { if(isset($this->pgadata[$i]['nracm'][$year][$month])){ $this->pgadata[$i]['nrac'] = $this->pgadata[$i]['nracm'][$year][$month]; //keep nr. access only unset($pgadata[$i]['nracm']); //remove 'nracm' from page data $pgadata[] = $this->pgadata[$i]; } } } }
With this:

Code: Select all

else { // gets the items with 'dt' between $first_d and $last_d $this_pgdata = $this->pgadata; //get $pgdata separatelly to not affect main object, used in the other tops $pgadata =[]; $this->num_rows = count($this_pgdata); if($this->num_rows > 0){ for($i=0; $i<$this->num_rows; $i++){ if(isset($this_pgdata[$i]['nracm'][$year][$month])){ $this_pgdata[$i]['nrac'] = $this_pgdata[$i]['nracm'][$year][$month]; //keep nr. access only unset($pgadata[$i]['nracm']); //remove 'nracm' from page data $pgadata[] = $this_pgdata[$i]; } } } $this_pgdata =''; //free memory }

beegee
that seems to have done it...thank you for both the speed in which you fix problems and your scripts. I recommend this program to anyone that wants to keep internal traffic stats of their site

Similar Topics