Introduce yourself here! In order to avoid spam, new users must first comment on the discussion in the 'Introductions' before they become 'full members'
fpstats
  • fpstats plugin provides some statistics about visitors of your flatpress powered sites...
    It's still early version, but logging won't be changed (for 99%) so you can use fpstats from now to log data about visitors even though you can't see extensive statistics at the moment...
    It creates new directory in fp-content/content/ and stores all "logs" there.

    Requirements:
    Flatpress 0.804 or higher
    PHP 5

    Wiki
  • I had try something with this plugin on my localhost installation and now I have a few questions:

    In the raw data, what mean the very long number between ip address and date/time?

    Why are the unique hits are changed, if I view the blog with a browser from the same ip address after a few minutes? The ip address isn't changed, so it should unique to that ip address I used before.

    If I logged in, disable the "http referer" and visit then some pages in my blog, so the very long number is changed in the raw data. What is happen, I'm the same visitor?

    Aside from that, really nice :)
  • screenies, post screenies! :)
    (and link the plugin on the wiki ;))
  • 2laborix: That is a session id - unique hits are calculated using session id not ip address. I thought thats the best way, since lot of people is behind nat, but it can be easily changed (or add a button that allows to change calculation method - this may be little bit harder, since overview results are cached).

    2NoWhereMan: As soon as I fix some "visual bugs", I'll create some screenshots and post a post :-) to the wiki...
  • One question again:

    After translating your language-file to german, I ask me where the "cantsave"-variable is used? Is it at present not insert in the plugin?

    If you wish to add the german language file to your plugin, please tell it to me here and sure we found a way to do that.
  • 2laborix: ups..."cantsave" is not used (and won't be used - it's an artifact from prettyurl plugin).
    Sure I would like to internationalize it... You can submit the file as a patch at the project web (link) - let me know if it does not work...

    2all: I've made a few small changes (like adding scrollbars to table with raw data to be able to see whole line)... You can get actual code from svn repository.
  • Posted By: matYou can submit the file as a patch at the project web (link)

    Hm, really curious. I added it to your link, but if I export your repos to my local harddisk, no german language pack is there. It seems that it is available in patches, but I'm not sure.
  • 2laborix: I've just made a commit of the file... Thanks for the translation...
  • I'm about to release v0.2alpha where is possible to display some simple graphs.

    Screenshots

    2laborix: Can you, please, translate following:
    'dayStats' => 'Day statistics',
    'weekStats' => 'Week statistics',
    'monthStats'=> 'Month statistics',
    'yearStats' => 'Year statistics'
  • cool. probably the most complex third party plugin for flatpress so far. How are you generating the graphs? gd2? google chart?
  • Posted By: NoWhereManHow are you generating the graphs? gd2? google chart?


    For graphs generation is used PhPlot (GPL or PHP license) library. This library uses gd2.
  • Posted By: matI'm about to release v0.2alpha where is possible to display some simple graphs.

    Hm, not easy in this case, because the german language is terrible :D

    I think, that's the best meaning:
    'dayStats' => 'Tagesstatistik',
    'weekStats' => 'Wochenstatistik',
    'monthStats'=> 'Monatsstatistik',
    'yearStats' => 'Jahresstatistik'


    edit:
    Is it possible that there is no weekly stats? I didn't see it on your screenshot and also not on my experimental site.

    And one question:
    Do you think about that all flatpress users have the needed library on their webspace? What is for users where don't have this library?
  • @mat: if I were in you, I would give Google Chart a look, it would lower the amount of work for your plugin, and therefore for your server (and probably would make it php4-compatible as well)

    nice job anyway :)

    bye
  • Posted By: laborixIs it possible that there is no weekly stats? I didn't see it on your screenshot and also not on my experimental site.

    No, there are not week stats yet.

    Posted By: laborixDo you think about that all flatpress users have the needed library on their webspace? What is for users where don't have this library?

    If you mean PHPlot - it's bundled in fpstats package, if you mean GD2 - I think this is almost standard part of php, but I can try to look for an alternative for these users.

    I've added bots (crawlers) filter, so you can see them separately in graphs (you have to clean fpstats cache - there is new button for it).
  • Ok, I've added week stats: screenshot.

    I've also added a few more lang constants (I think, "crawlers" will be the same, but can you, please, translate the two others?)...
    'crawlers' => 'Crawlers',
    'purgeCache'=> 'Purge cache',
    'confirmCacheCleaning' => 'Cache refreshment is quite expensive. Are you sure?'
  • Posted By: matI've also added a few more lang constants (I think, "crawlers" will be the same, but can you, please, translate the two others?)...

    Did you seen the last translation in Sourgeforce "fpstats patches"?

    Ok, there is now a new translation in Sourgeforce "fpstats patches", which include your current lang constants and my changes from the last translation. Have fun...

    But now I have new question. The generated log files can be very large, I don't know how large after a few months. What do you think about that?
  • Posted By: laborixThe generated log files can be very large, I don't know how large after a few months. What do you think about that?


    Every month has its own log file. More than one file is loaded, if you set filter to more months (like 1.1.2008 - 31.12.2008) or if you purge cache file. Data used in graphs and day stats are kept in "cache" file so every time you view this page, only new records are calculated. But there is still place for optimization (more files than necessary can be loaded sometimes), but I'm still missing other functionality (like top browsers, top entries...) so it'll have to wait some time. :-)
    My actual log file with 514 entries has approx. 162kB. I can imagine that some blogs has thousands visitors per month (including bots). If the log files will be too big, they will have to be split to e.g. weeks - if so, I'll write some conversion script.

    Thank you for the lang file and also for the questions.
  • can you make version of fpstats for php4?
  • Posted By: ZoLToRcan you make version of fpstats for php4?


    Sorry, there won't be PHP4 compatible version. The end of life cycle of PHP4 is set to 8. 8. 2008, so you should switch to PHP5 in near future...
  • I'm using flatpress for my site in LAN and all servers (web, mysql, ftp, etc. =))) are installed on my home desktop pc.. And all works fine but PHP5 is high loading my CPU... With PHP4 all normal... But, it is other topic)))
    thanks for the answer
  • People, I've installed the fpstats but I get this error:

    Warning: Invalid argument supplied for foreach() in /www/110mb.com/m/y/w/o/r/d/s/0/mywords01/htdocs/fp-plugins/fpstats/classes/OverviewManager.php on line 21

    Warning: Invalid argument supplied for foreach() in /www/110mb.com/m/y/w/o/r/d/s/0/mywords01/htdocs/fp-plugins/fpstats/classes/OverviewManager.php on line 117

    Warning: krsort() expects parameter 1 to be array, null given in /www/110mb.com/m/y/w/o/r/d/s/0/mywords01/htdocs/fp-plugins/fpstats/classes/admin_plugin_fpstats.php on line 105

    Anyone help? Thank you!
  • 2ychu: I've added some "array cheking", could you try actual version from repository: link? Thanks
  • It seems to be working now... without be even reinstalling.

    Thanks.
  • n it's really a great plugin! I was looking for things like thie for some time. Thanks a lot!
  • Is it possible to filter my own hits? Maybe just to exclude one specific IP address from the statistics would be enough for me, is it possible?
    Thanks
  • 2emko: No, it is not possible to use such a filter.
  • Hello,

    1. I use fpstats plugin and i found bugs:

    Notice: Undefined variable: data in /httpd/html/neduduhu/www/fp-plugins/fpstats/classes/FPStatsBaseClass.php on line 104

    Notice: Undefined variable: toBeRemoved in /httpd/html/neduduhu/www/fp-plugins/fpstats/classes/FPStatsBaseClass.php on line 125

    My computer not problem, my server (forpsi.hu) found a little bug.

    2. UTF-8 string not correct on plot graph.

    Hungarian characters
  • Some of you might know that in FP there's a little easter egg: statistics about number of entries, number of comments, disk space used and most commented entries. To show these infos it has to be modified some admin file (couldn't remember which!)...
    The bad is that every time these infos are recalled the system must scan the whole fp-content directory to count comments, entries and disk space.

    What about adding to fpstats these information, too?
    Maybe in a way that these infos are stored in a file (so that infos are not taken by scanning fp-content\) and at every new entry/comment the stats are automatically updated? The files that contains the functions are admin.entry.stats.php and admin.entry.stats.tpl!
  • it's /admin?p=entry&action=stats
    I would either move that to its own plugin and/or integrating that (cached) information in a sort-of dashboard in the the main panel http://i41.tinypic.com/x3s9pg.png
  • Yeah, it could be an idea... You're the boss, so it's up to you!!! :)
  • 2. UTF-8 string not correct on plot graph.

    Sorry for late answer... Can you try to set up ttf font for phplot?
    How to:
    1) open fpstats/phplot/phplot.php
    2) find lines 46-48
    3) change according to your paths.
    Alternatively
    3.1) download e.g. http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/
    3.2) unzip chosen .ttf file into fpstats/phplot/
    3.3) set line 46 to true, line 48 to the name of chosen font file

    Let me know if it helped or not...
  • Posted By: mat2. UTF-8 string not correct on plot graph.
    Sorry for late answer... Can you try to set up ttf font for phplot?
    How to:
    1) open fpstats/phplot/phplot.php
    2) find lines 46-48
    3) change according to your paths.
    Alternatively
    3.1) download e.g.http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/
    3.2) unzip chosen .ttf file into fpstats/phplot/
    3.3) set line 46 to true, line 48 to the name of chosen font file

    Let me know if it helped or not...

    Hmm, no no no :(

    I download ttf fonts and copy in phplot directory.

    Error: SetFont(): Can't find TrueType font 3

    Tested in arial, Vera, DejavuSans fonts.

    Any idea?

    Thanks Peter

  • Error: SetFont(): Can't find TrueType font 3
    Any idea?


    Please download last version of GraphHandler.php from repository and replace a file located in fpstats/classes/. There was a bug. Works for me now...
  • Thank You! Perfect!
  • I don't know if it's fpstats-related, but I found a little problem with this plugin. If this plugin is enabled my RSS doesn't work, giving me this error
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4016083 bytes) in /home/marcover/public_html/fp-plugins/fpstats/classes/FPStatsBaseClass.php on line 156


    If I disable the plugin my RSS will work again (even if my feedburner feed doesn't work, it only works the default rss, but I think this is another problem, maybe due to some installation problem!)

    EDIT:
    Feedburner is just gone back to work!
  • EDIT:
    Feedburner is just gone back to work!


    Is the problem solved? I'm getting no errors whatever I'm doing with rss/atom...
  • Yes, now the problem is solved... But I don't know why I get it again if I ebanle fpstats...
  • What version of fpstats do you use? A New version was published +-two weeks ago (some bugs were fixed)...

    Edit:
    And what version of php is installed on the server?
  • I uploaded the version I was using 'cause I thought the problem was caused by the old version... PHP 5.2.8!
  • Now that it comes back into my mind... I forgot to tell you that I had blog url and blog email totally f***ed up... Could that be the cause?
  • I forgot to tell you that I had blog url and blog email totally f***ed up...Could that be the cause?

    I don't think so...only in case there is some bug in php serialization (e.g. some chars from url would not be escaped)...
    ---
    You can try to replace (in FPStatsBaseClass.php):
    (line 23)$record["REQUEST_URI"] = $_SERVER["REQUEST_URI"]; with $record["REQUEST_URI"] = "";
    (line 26)$record["HTTP_REFERER"] = $_SERVER["HTTP_REFERER"]; with $record["HTTP_REFERER"] = "";
    If you do this, URLs won't be logged=serialized...if the problem is in url serialization, it should work now and I'll now, where to look for...
    ---
    You can also try to remove stats data to check if there is something wrong in "fpstats database"- remove (or simply rename) directory: fp-content/content/fpstats - please make a backup...
    ---
    Can you give me an example of your URL?
  • Sorry for my late answer, I just saw your suggestion!
    I tried to change FPStatsBaseClass.php and to remove stats data, but the problem is still there...
    I made some try with FF:
    1) I tried to subscribe to my RSS (by clicking the icon in the URL bar) from the index: my feed is added to the bookmarks but nothing is shown;
    2) I tried to subscribe to comment RSS of this post. Everything went fine!
    3) I tried to subscribe to blog RSS from the same post, and I got the same error described in 1).
  • If I go to provided link (your post) - if you have ment RSS named "RSS dei commenti" - see html of this link - there is a problem:


    <a href="<br />
    <b>Warning</b>: Missing argument 3 for theme_def_feed_comments_link() in <b>/home/marcover/public_html/fp-includes/core/core.theme.php</b> on line <b>429</b><br /> <br />
    <b>Warning</b>: Missing argument 3 for Plugin_PrettyURLs::commentsfeedlink() in <b>/home/marcover/public_html/fp-plugins/prettyurls/plugin.prettyurls.php</b> on line <b>97</b><br />
    http://marcoverga86.netsons.org/index.php/20///giu-dalla-montagna/comments/feed/entry090102-182134/">RSS dei commenti</a>


    Also the URL has to much slashes...
  • that modifier is broken, use this ugly syntax, I'll try and fix it later

    {''|tag:post_comments_feed_link:rss2:$id}
  • @ mat: No, I didn't mean that link... I meant the orange RSS icon in the URL bar!
    BTW, I changed the code and now also that link works...
  • committed in rev.236; new syntax is {$id|link:post_comments_permalink:rss2}
  • Well, all RSS on your blog seem to be working for me (subscribe to RSSs and show them)...
    ---
    I have no other idea why you get the fatal error:

    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4016083 bytes) in /home/marcover/public_html/fp-plugins/fpstats/classes/FPStatsBaseClass.php on line 156


    I'm planning to do some rewriting/refactoring of fpstats code in a second part of February, hopefully it also solve this problem...
  • there are obvious downsides using serialize/unserialize for large chunks of data; when you serialize a big array, for instance, you get in memory about twice the same amount of information in memory.

    Since PHP allows the system administrator to set a hard limit on memory consumption to avoid leaks, when you try to allocate a large amount of memory this error might occur.

    This is one of the reasons for which FP switched to the BPlusTree data structure.

    However, some part of FP were not ported to the new data structure, like PrettyURLs, which still uses a serialize/unserialize approach (even though it's been changed since Vivace), and which might be heavy on memory usage, depending on how many entries you write each month.

    Here's how it works (I suppose fpstats works in a similar way at a first glance).

    PrettyURLs keeps one file for each month of the year, in which is kept a serialized array map of the form
    $INDEX [ YEAR ] [ MONTH ] [ DAY ] [ MD5-OF-THE-TITLE ] = ID

    when a page is requested, say, http://mysite/flatpress/2009/01/27/some-title/
    prettyurls computes MD5-OF-THE-TITLE = md5( "some-title" ), and the searches through the $INDEX map with
    ID = $INDEX [ 09 ] [ 01 ] [ 27 ] [ MD5-OF-THE-TITLE ]; if ID exists it is the ID of that entry.

    Notice that there might be collisions if you choose the same title more than once: that's the reason for putting them under year/month/day: it is unlikely you'll choose the same title the same day; if you do a collision will occur and PrettyURLs won't work properly: this edge case IS NOT HANDLED.

    The index is handled by a class (a ugly class for the whole plugin, but well...) which loads the correct sub-file each time some day is requested.

    Now, suppose you want to get the last 5 items from this list, and you have only 1 for january 2009 and 10 for december 2008: you'll load both the files for december and january.

    Suppose the limit is 10 entries (it is not) in the index : BAM.

    BTW this is highly unlikely, moreover for how PrettyURLs works it is only checked one file per request, so we're pretty safe.

    How to avoid the memory limit here without BPlusTree?

    It depends.

    If you're sure about the field sizes you can fread() rows of data from the DB files (of course, you'll have to write concordantly), or you can read from current offset to the next newline with fgets(), etc; in this case you must be sure that nor DELETIONS nor INSERTIONS will occur, or you'll have to re-sort the file, or using an index (which would bring us back to the B+Tree)

    OR, you can split a month file into two when a certain limit of records is reached, so you can keep the serialize/unserialize thing.

    Finally, @marco, did you try and delete last month's stats file and see if the error still occurs?
  • I deleted the whole 2008 stats and well, the error is still there! :S
  • 2NoWhereMan: Thanks for description... I'll think about switching from array serialization to something more memory friendly... :-)
  • I deleted the whole 2008 stats and well, the error is still there! :S


    did you delete last month's as well? (you don't really have to delete, just move it somewhere else)
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion