[announcing] Statistics plugin

Discussion corner for Developers of Serendipity.
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

[announcing] Statistics plugin

Post by SHRIKEE »

I found a neat plugin while installing s9y. The statistics plugin...

Im missing one thing tho which is some uservisit graphs. Currently im trying to make that now with the existing 'statistics' data. All what i need is saved but not used 8)

These graphs will not be shown public.

Also im not interrested in the top15 posts and whatever more is shown on the page as im the only user of the site so i build in a switch to hide that part and show only the visitor count and graphs.

Ive setup a small page here:
http://www.sothq.net/projects/statistics.html
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [announcing] Statistics plugin

Post by garvinhicking »

I can't yet see a picture or download link for that? If you can submit a patch or so, I can of course submit it to the core plugin in serendipity :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

thats the plan!

i havent really started yet... just the idea is there and i made the option to hide data... 8)

the end product will be an updated (or 'patched' as you call it) statistics plugin which will be submitted to your database some additional info then can be found on my site aswell as a separate download.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

That sounds great! Looking forward to that!

Do you know about some PHP based graphic plotters? JPgraph AFAIK does a lot of that stuff. But we need to pay a close look on licensing; only BSD-licensed code can be put into the statistics plugin. if that does not work, we would need to create a second, unrealted plugin that includes GPL code or whatever to display things... :-/

Have fun,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

im not using image plotters. Those are resource consuming and require often a silly license.

Im using a 1x5px image which will the stretched for each graph bar. A simple sum calculates the height of the image and color. Red/yellow/green.

Its not to advanced and thats where the power lies.
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

Im curious.

When i compare my stats with a program called webalizer s9y has much higer stats.

How does it count visits exactly?
Ive seen it works with sessions instead of time of entry. Is it that when i enter the page a session is created. THen when i close my browser the session is killed (browserbehaviour). And when i go to the page again it counts another visit because theres no active session?

I hope not 8) This would mean i (or anyone) could easily fake my stats :(
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Visitor counting is done based on Session cookies. Serendipity as a web application has no other means of inspecting identical visits.

In fact, using a session data is the only real way how unique visitors can be determined; Tools like webalizer only can use a IP address which is even worse because Proxy users can totally screw statistics.

Either way your statistics can be faked. There is no way apart from using a login-forced webpage to count unique visitors.

When IP addresses would count, anyone could fake your stats by using a proxy to access your site, so faking/altering statistics is always possible.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

i know that.

but how is a visitor being counted on s9y? per session or per day or how? When does the session cookie expire?
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

According to the code, it currently tracks the simple PHP session_start cookie, which is deleted on browser close and is valid until the PHP configured session time limit.

Every hit of a visitor is counted and incremented once a day for that session id.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

i see.

I've started the monthly graph today
i get this as output:
Fatal error: Call to undefined method serendipity_event_statistics::statistics_getmonthlystats() in /var/www/html/plugins/serendipity_event_statistics/serendipity_event_statistics.php on line 643
Line 643:
$temp = $this->statistics_getmonthlystats($i, $visitors_count[0]);

Any clues?
thanks!
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

It seems you did not declare a statistics_getmonthlystats method. Methods that are references with $this->... need to be declared within the Class { ... } parts. If you declare a function within a class, it's called a method and cann be accessed through $this->.

If you declare a function outside of class { ... } it's a simple function that may not be called with $this->, but directly like statistics_getmonthlystats().

See http://de2.php.net/manual/en/language.oop.php

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

i kinda figured that yes.

i also figured im a huge and silly clown... Ive put the function inside another function :oops:
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

:-)

That's not a problem, BTW - PHP allows to define functions within functions. A funny concept. :-)

Code: Select all

<?php

function cool() {
  function verycool() { echo 'very cool'; }
  echo 'cool';
}

cool();
verycool();

?>
But this doesn't make sense in most cases ;-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

well it didnt work, when i put the function somewhere else it worked...
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
SHRIKEE
Regular
Posts: 128
Joined: Tue Feb 21, 2006 2:49 am
Location: Netherlands
Contact:

Post by SHRIKEE »

is there any way to just run a query like this

$container[$i] = serendipity_db_query("SELECT count(visits) FROM blehblehtablename WHERE year='$year' AND month='$month'", true);

without getting the result put in a array or some other stupid value?
I just need a number returned.

thanks!
My kingdom For i am king of my heap of trash

Developing code on:
Workstation: Windows 2000 sp4, TSW webcoder 2005
Server: fedora core 4 amd64, apache 2.0.54, php 5.0.4, mysql 4.1.11.
Post Reply