Statistics Module
aidanlister
Joined: 2005-12-07
Posts: 56 |
Posted: Sat, 2005-12-10 00:24 |
Hello, I've written a statistics module. Here's the info on Codex: If you have any ideas for features, design or improvements on the current code, please post here or on the codex and let me know - Thanks! |
|
Posts: 56
As of writing
* All Entries [Removed for the moment]
* General [Working]
* Disk Usage [Working]
* User Stats [Removed for the moment]
* Latest events [Working]
Posts: 56
Hello,
General Statistics is now complete, as is Latest Events.
Posts: 32509
if you haven't already:
- think about modularizing: each module should provide statistics, your module shouldn't be aware of all other modules. that way, module authors can offer statistics when they write a new module and you don't have to keep track of all new modules.
e.g. check for modules that implement a function getStatistics() or so
- almost all (web) applications that offer a statistics view must use caching. without caching, each page impression would recalculate all the statistics (run x database queries etc etc).
Gallery offers GalleryDataCache::putToDisk etc. to cache data on the disk. another approach would be to cache the data in the database with GalleryCoreApi::setPluginParameter() or in a dedicated table, if necessary
also, please offer a .zip download or another packaged format.
if you want cvs access, we can give you cvs access to sf.net/projects/gallery-contrib/ which is used by a few module developers.
Posts: 62
I will definitely install Gallery 2.02 and install this just to try it out! This is too tempting to ignore. Being the reason why my gallery is still running on 1.51 engine.
Thank you very much for this statistic module. I personally am not a programmer so I'm afraid I can't show you much appreciation or suggestion.
Though I do have a few idea. If you have not been aware of it yet, perhaps it would be nice to turn off certain statistic and make sure the server will not still calculate it. When a gallery become huge and populated, the statistic certainly can put a troll on the database query. I believe that is one of the reason why the old gallery slow down as the size got bigger.
I also agree with Valiant, without caching the site will be very slow.
And about the zip download, that would be a lot better. Downloading each file seem like a pain. I do not want to add more work for you but if there are anything I can help I will gladly provide it!
Posts: 19
I've downloaded your code (with WGET to make sure I got everything). There is obviously something I need to do to enable to module and I don't know what it is. One point to make is that my gallery is a multi-site setup.
I moved everything in the statistics directory (including obviously the statistics dir. itself) into "gallery2/modules". The moment I click "siteadmin > Modules" I see the php code from you module in the web browser. At the bottom of the page isn then shown a Gallery errormessage:
Error Detail
Error (ERROR_BAD_PLUGIN) : Class statisticsModule does not exist
* in modules/core/classes/helpers/GalleryPluginHelper_simple.class at line 113 (gallerystatus::error)
* in modules/core/classes/GalleryCoreApi.class at line 187 (gallerypluginhelper_simple::loadplugin)
* in modules/core/AdminModules.inc at line 227 (gallerycoreapi::loadplugin)
* in modules/core/SiteAdmin.inc at line 153 (adminmodulesview::loadtemplate)
* in modules/core/classes/GalleryTheme.class at line 688 (siteadminview::loadtemplate)
* in modules/core/classes/GalleryView.class at line 285 (matrixtheme::loadtemplate)
* in main.php at line 287 (siteadminview::doloadtemplate)
* in main.php at line 87
* in main.php at line 80
* in /home/virt_hosts/graabek.com/domains/photo.graabek.com/html/main.php at line 3
System Information
Gallery version 2.0.2
PHP version 4.3.9 apache2handler
Webserver Apache/2.0.52 (CentOS)
Database mysqlt 4.1.12
Toolkits ImageMagick, NetPBM
Operating system Linux server.graabek.com 2.6.9-22.0.1.ELsmp #1 SMP Thu Oct 27 14:49:37 CDT 2005 x86_64
Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Posts: 12
installation problem solved!
by downloading form aidanlister's site, it created me HTML-pages. By extracting the original text and update the files on the server, it works.
now download my version directly from
EDIT - sorry had to shotdown my page! problems with jemako.com - EDIT
i hope installation works by everyone!
i've got only no results at:
- all entries
- disk usage (album:today, size:Hello, total space: .../...)
- user statistics
although: a very BIG THX to aidanlister !!! very good work !!!
peace!
VoiceX
old text:
the same thing as by bgraabek happens also by me
what i did additionally: i created a directory statistics
hope for solution, please!
-------------------------------------
GreetX from Switzerland
VoiceX
Posts: 77
Posts: 77
False alarm, its working, great job on it
Posts: 43
Really interested in this module, just gon' wait a little while more before I try it but it has all my needs!
Posts: 397
I am getting the same error. What did you do to solve this? Looks like an excellent module.
Posts: 56
Hi,
I think you may possibly be including some extra unintentional whitespace when you download the files. Check each file for spaces above <?php or below ?> and remove them. That should fix the problem.
I'm sorry it's so inconvenient to install at the moment, I'm going to finish a first revision of the code tomorrow then put that in CVS - which chris has kindly set up. Once that is done, I shall release a version and you'll be able to download it in a zip file.
Posts: 56
Hello!
I've added the DiskUsage section, and uploaded the release on CVS and SourceForge.
You can download it here:
https://sourceforge.net/project/showfiles.php?group_id=142706
Posts: 43
---------
Total space used 1.59 GB
Total space available 71.63 GB
Percentage space available 97.78%
---------
Filesystem Size Used Avail Use% Mounted on
/dev/hda6 67G 38G 30G 56% /home
Something is a little bit fishy here, don't you agree?
(Yes, I am sure about the partitions..)
Other than that, it seems to be working fine
Posts: 12
same thing happend by me:
Item Value
Total space used 75.72 MB
Total space available 79.60 GB
Percentage space available 99.9%
i've got 500 MB diskspace. Is it possible to enter this value manually?
and can i sort the listing by used diskspace?
THX ALOT for this great work !!!
-------------------------------------
GreetX from Switzerland
VoiceX
Posts: 56
Hello,
I've fixed the percentage space available, and changed the album breakdown so you can see parent/children albums in a tree. I won't sort by size, because it would break the tree.
I'll release a new version later this week, I'm glad you like it
Posts: 62
This is coming alone exceptionally well. I'm glad we have someone who know what they are doing to work on this mod. While it is not something everyone will need, this will be one of the mod that give Gallery a polished touch which can be felt by every user.
I have problem with generating link that will directly display state (like a link that will display the newest upload) but I am happy about the progress already!
Posts: 56
Hi id01, I've just fixed that bug, the updated code is in CVS.
http://cvs.sourceforge.net/viewcvs.py/gallery-contrib/gallery2/modules/statistics/
Posts: 6
Thank you so much this is just what I was looking for. Keep up the great work.
Posts: 43
Looks like it's working like a charm now.. takes some time getting the disk usage page up, though..
Posts: 1023
hmm, my disk usage simply times out, the other info section work perfectly.
(I'm using the latest CVS - 19.12.05)
Gallery version=2.0.2+ core 1.0.10
PHP version=5.1.1 apache2handler
Webserver=Apache/2.2.0 (Win32) DAV/2 PHP/5.1.1 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_perl/2.0.2 Perl/v5.8.7
Database=mysql 5.0.16-nt-log
Gallery-URL=http://lf-photodesign.de
Posts: 32509
you'll have to add a progress bar view to compute all the statistics and then cache the result (db or GalleryDataCache::putToDisk) for future requests until a timeout is reached upon which you run the computation again.
Posts: 31
RFE: An API for other modules to record stats with. My thinking was that my Coralize modules could register that it would want to keep track of some stats in various buckets and then when it did things it could add amounts to those buckets and the stats module would take care of presenting that info to the user.
I've updated: http://codex.gallery2.org/index.php/Gallery2:Modules:Statistics#Feature_request
Posts: 32509
I'm +1 for modularization of stats. but the stats module should keep the history / last results and return them to each module such that they can compute new results based on the old ones.
similarely to the function getRewriteRules() that can be implemented by any module and is checked by the rewrite module, there could be something like
function getStatistics($params, &$data) {
whereas $params contains options and the timestamp of the last time data was requested and $data contains the current from the last run and is meant to be updated.
the module can choose to compute everything from new or to update $data.
...
return GalleryStatus::success;
}
Posts: 62
Is there anyway I can generates a user accessable page with the lastest statistic?
Posts: 134
Thank you for this nice module... Great work!
http://www.mincel.com/gallery
Posts: 431
Another +1 for other modules being able to register stats. I'd like the Checkout module to be able to return things like the number of completed transactions, abandoned carts, total order values, etc, and the Statistics module seems the ideal place to send that information.
Posts: 24
2aidanlister
Thanks for this module,
Could you describe what you plan to integrate in
- User Stats [Removed for the moment]
- All Entries [Removed for the moment]
Here is my whish list
For User Stats :
- Top20 most recent requesting hosts/country
- Top50 requesting hosts/country
For All Entries :
- Most viewed image/gallery
- Weekly top50 images/galleries and daily top20 images/galleries
- List all or X galleries sorted by the number of views
- List all or X images sorted by the number of views
For Latest View :
- Will it be possible to add Hour, Host/IP and if possible country ?
Thanks
_________________
Gil
My Gallery http://mesphotos.fontismedia.com/
Posts: 56
I've just released a 0.2.0 version. Nothing much has changed, I've just fixed a few bugs and cleaned up some of the code. I'll get working on the features requested once I get some spare time! Thanks for your support!
ZyreX: I'll fix that in the 0.3.0 release by generating the statistics once, then displaying them.
LFrank: See above
sandymac & others: I'll start working on an API for this once I get some free time. It's a great idea.
id01: Yep, that's planned for the next release too. I'll make a statistics block available and customisable.
gbo: User Stats would have information about each of the users galleries, how many pics, how often they look at it, etc. All entries would list all the items in the gallery, not feasable for any gallery of decent size. In regards to your wish list, unfortunately gallery doesn't take or store any of that information, you're going to have to examine your server logs
Posts: 62
How easy would it be to get a total page views inside an album? Instead of just views of each individial items?
Posts: 107
The current version doesn't work with the latest snapshot as the core APIs have changed and don't validate any more.
Is there any CVS version of the module available that would work with the new APIs?
Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com
Posts: 214
Would it be possible to add "last sent eCards" to the statistics module?
So that it's viewable whicheCard is sent most and possibly who wrote which text (in case of spam or other abuse).
Posts: 214
Another one wit G2.0.2 and 0.2.0 stats module
My G2 is quite large:
Total Items 90850
Total Albums 956
Total Views 1863622
Total Users 3
Total Comments 878
When I click on "Disc space" I get an error after a while. But 25MB seems to be quite a lot for a script.
Fatal error: Allowed memory size of 26214400 bytes exhausted (tried to allocate 88 bytes) in /www/htdocs/techno/gallery2/modules/statistics/classes/StatisticsAdminDiskUsageHelper.class on line 153
Posts: 1
first off:
-- great module..
-- very slick and easy to mod
found a bug in the 0.2.0 release, templates/StatisticsAdminLatestEvents.tpl, line 64:
instead of iterating over $StatisticsAdmin.LatestEvents.latestAdditions in the "Latest Additions" section you again iterate over $StatisticsAdmin.LatestEvents.latestViews
other than that great job!
-- solid
Posts: 56
The current CVS version (0.2.1) has been updated to use the new Gallery API. I've fixed the bug solid has reported (iterating wrong var), but have not had time to address any other issues - really sorry.
Posts: 132
Looking for a way to hack this module to export total page views per each album. For another word, it will add up all the total hits for all items under an album.
Any idea How I should do this to generates a page that list the views, similar to the Disk usage page?
Posts: 27
First, Thanks for the awesome module!
Second...
I'm experience a weird issue where under Latest Events, if a picture has no "caption", the filename with the link doesn't show. Gets more interesting where another installation of gallery on the same codebase works fine.
I've tried matching theme to the working gallery theme - same result. Am I missing setting a permission somewhere ? What else can this be caused by??
Thanks a lot
Vahan
Posts: 56
Eka_Mei: the algorithm to do this is quite complex, when I get some spare time I'll implement it.
vahan1: that bug was fixed in 0.2.0 release, check you have this version installed.
Posts: 27
aidanlister,
thanks for the tip. Actually I do have 0.2.0 installed, but I upgraded from the version with the bug.
I had to uninstall the module, delete <specific-gallery-data-directory>/cache/module/statistics, and reinstall.
worked like a charm.
thanks again
-v
Posts: 204
Incompatible module!
Core API Required: 6.8 (available: 7.2)
Module API Required: 2.0 (available: 3.0)
Does this not work with 2.1-rc-2a?
Posts: 107
Ranger187:
It doesn't work yet with 2.1-rc-2a out-of-the-box. The module may be updated soon to accomodate for the API changes but I wouldn't expect anything final until there is a 2.1 final out as well. The statistics module accesses a lot of core functions from G2 so it needs to work on a final version of it.
Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com
Posts: 57
Provides statistics about Gallery
Incompatible module!
Core API Required: 6.8 (available: 7.1)
Module API Required: 2.0 (available: 3.0)
Same thing, any update on compatibility?
Posts: 204
Iamnear,
Just like he told me, it's not fully working with 2.1 yet. Now if you are not running 2.1 you should have posted your version number to begin with. ;)
Posts: 1023
if you're running 2.1 - the CVS version neccessary is available to test too.
Gallery version = 2.1-rc-2a core 1.0.34
PHP version = 5.1.1 apache2handler
Webserver = Apache/2.2.0 (Win32) DAV/2 PHP/5.1.2 mod_ssl/2.2.0 OpenSSL/0.9.8a
Database = mysql 5.0.18-nt-log,
Theme=PGtheme,
Gallery-URL=http://lf-photodesign.de
Posts: 57
Okay, any time frame available for when this module will be available for 2.1?
Gallery version = 2.1-rc-1a core 1.0.28
PHP version = 4.3.11 apache
Webserver = Apache/1.3.33 (Unix) mod_auth_passthrough/1.8 mod_jk/1.2.0 mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.6b
Database = mysql 4.0.25-standard
Toolkits = Gd, Exif, Thumbnail
Operating system = Linux host.bh.xgb.net 2.4.20-28.7smp #1 SMP Thu Dec 18 11:18:31 EST 2003 i686
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
Posts: 56
The current CVS version (0.2.1) has been updated to use the new Gallery API (Gallery version 2.1).
http://cvs.sourceforge.net/viewcvs.py/gallery-contrib/gallery2/modules/statistics/
Posts: 107
Is there any way to download the latest CVS snapshot for it in a tarball? The machine I'm currently in can't do CVS and saving each file manually is a PITA (I'll never understand why the viewcvs.py can't do this itself: Download Dir as tarball)
Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com
Posts: 12
For all users who don't want to use cvs enclosed the statistics module for Gallery 2.1 as zip.
--
http://www.longstag.com
Posts: 107
Thanks a lot, longstag. Works a treat.
Eduo
---
www.eduo.info
www.eduo.info/gallery/
www.hamsterspit.com
Posts: 57
I was rather disappointed with statistics, I was hoping this module would offer specific information on individual user sessions from what images (and for how long) a user views -- to tracking their entire gallery viewing sessions.
Are there any plans for this?
See logging module thread http://gallery.menalto.com/node/46376
Posts: 352
I use bbclone to accomplish that type of use profiling. See http://codex.gallery2.org/index.php/Gallery2:How_to_embed_counter_code_at_the_page_bottom#BBClone
BTW, I love the statistics module and I think that it combined with BBClone gives me all the information I need. Thanks.
Steve Lineberry