I found this an interesting idea, I had some ideas on implementing it
and decided to try it:
http://tiddlywiki.mahemoff.com/ViewingTimesPlugin.html
The plugin takes periodic samples (once a second) to see what the user
is viewing. It looks at the first element in the story, which will
work fine for a slideshow-type tiddlywiki or one using SinglePageMode,
though mightn't be ideal for other situations. You could also replace
the sampling technique by one which hijacks display events.
It doesn't address all of your concerns, but hopefully gives you some
ideas on how one might implement this.
Yes, this came up this morning - my site was hacked among with
numerous other dreamhost sites in the past couple of months :(. I've
taken measures, but it will take a while for the message to clear.
You can click through anyway, or you can also find the code in my SVN area.
http://svn.tiddlywiki.org/Trunk/contributors/MichaelMahemoff/plugins/ViewingTimesPlugin/
I should clarify that the plugin here just shows the information back
to the viewer, for their own purposes, rather than aggregating views
and providing server analytics.
It could be extended to do that. I could imagine a write-only (unless
you have admin permissions) tiddlyweb "views" bag that would contain a
tiddler for each time the user viewed something. It would grow big
quickly and therefore require something like the SQL store in most
cases. And it would need an analytics viewing tool too.