Jul 29, 2004 Nomadig:

Since last visit for shortstat

Do you visit your shortstat several times a day? I do, and thus I got a nifty idea for improving the system for showing me the number of visits between my visits to the stats.

The idea is simple. Some IP addresses are marked as admin addresses in the configuration.php. Then if the shortstat visitor comes from one of these addresses, the index.php sends a cookie that contains the current timestamp.

Later, when a user comes with that cookie, the timestamp is retrieved from the cookie and new timestamp is put into the place — to mark the current visit. Now we know the timestamp of the previous visit and can dig hits and unique hits after that timestamp and show them in the stats display. Simple, eh?

The cookie is stored for two months and renewed every time I visit the stats page. Other visitors do not see this information. Of course, it could be made configurable whether you allow visitors to track their own visits or not.

The only bad thing — for you — is that I’ve tweaked shortstat a lot, and I’m unsure would it still be possible to include this feature as a patch without breaking the existing functionality. I have corrected a lot of small coding mistakes, such as “blah $foo[bar] blah” into correct format of “blah {$foo['bar']} blah”, and optimised the code to use common utility functions.

I haven’t heard anything from Shaun — no reply to my email or any comments in the blog — so I’m tempted to make a new release of my own. I’m not really sure should I do it or not, as I really have other things to do, but on the other hand it would be real shame not to release these improvements to the public.

In the long run the system should go through some major overhauls, as the database schema could be optimised for smaller footprint and better performance.

5 Comments

The URI to TrackBack this entry is: http://www.nomadig.com/2004/07/29/since-last-visit-for-shortstat/trackback

1. David — Wednesday, Aug 11 2004

Janne,

I don’t seem to be able to get Shortstat to count any of my pages. I have tried uploading a .htaccess file with different settings, but when I do, I cannot access any page at all!

I have tried including the line…
<?php include_once($_SERVER["DOCUMENT_ROOT"].”/shortstat/inc.stats.php”); ?>
…at the top of the pages that I wish to have counted, but nothing seems to register.

I don’t know what I am doing wrong.

Would you have any ideas that could help me?

Thanks,

DR

2. David — Wednesday, Aug 11 2004

Sorry to mess up your blog Janne, by talking to myself, but I found the answer…
1. the extension of the file had to be “.php” (instead of “.htm”); and
2. the line only has to read…
<?php include_once(”shortstat/inc.stats.php”); ?>

Thanks. ;o)

DR

PS - I would be interested to see how different your hybrid Shortstat version operates!

3. Janne Kalliola — Wednesday, Aug 11 2004

You can check nomadig.com stats at http://www.nomadig.com/shortstat/

Unfortunately, you cannot see the since last visit, as only my IP address is configured to ShortStat.

I can’t give you a link as ShortStat has checks for referer header and linking yields to nomadig.com homepage. Maybe I should allow refering from nomadig.com. If somebody sees any security issues with that, please get in touch.

4. Steve p Sharpe — Tuesday, Jan 4 2005

Hi,

Is there any chance I could get a copy of the code so I could make my shortstat look like yours does?

If so could you mail me..

Thanks

Steve

5. Janne — Wednesday, Jan 5 2005

Steve, all the changes except this since last visit are shown in the previous entries, check out

Leave a comment

The following Textile shortcuts are available:

_emphasis_
*strong*
@code@
^superscript^
~subscript~
+inserted text+

Hyperlink:
"link text":http://link.url

Image:
!http://image.url!

Lists:
* bulleted
# numbered

Hide help

Please be polite and use common sense when posting. Any comment is subject to removal. The e-mail address is required, but it is not shown to anybody else than the administrator.

Commenting uses Textile and your message is previewed below. Show Textile help

Write your comments

 

Preview

6.  — Jan 6 2009