Tracking tiddler popularity

34 views
Skip to first unread message

Ken Girard

unread,
Apr 23, 2007, 8:53:27 AM4/23/07
to TiddlyWiki
It occurred to me as I was taking a shower (I do a lot of my best out-
of-the-blue thinking in the first hour I am awake) that if I had a
macro that placed a call for [img[<currenttiddler>.gif]] in each
tiddler, then I could then allow my error reports to tell me how often
a tiddler was viewed (Meaning I am not going to create the image file,
so it would count as an error). Of course this only works with an
online TW that actually reports errors.

And while I think I could actually figure this plugin out, I would bet
that at least one of you has three-quarters of the code written in
your head by the time you got to this point in the message, and most
likely prettier then what I would come up with.

Ken Girard

SylvainComte

unread,
Apr 25, 2007, 10:54:30 AM4/25/07
to TiddlyWiki
not sure if this is what you're expecting, but i did some hack in
ccTiddly to include Google Analytics and Iminr code... I think it
should work on classic TiddlyWiki, but i'm not sure.

0. create a Google Analytics account

1. modify the MarkuPostHead to include google analytics external code
<!-- Fonction Google analytics {{{ -->
<script src="http://www.google-analytics.com/urchin.js" type="text/
javascript"></script>
<script type="text/javascript">
_uacct = "YOUR ANALYTICS CODE";
function comptageGoogle(titre) {
urchinTracker(titre);
}
</script>

2. create a tiddler tagged with systemConfig to hack refreshTiddlers

Story.prototype.refreshTiddler = function(title,template,force)
{
var theTiddler = document.getElementById(this.idPrefix + title);
if(theTiddler) {
if(theTiddler.getAttribute("dirty") == "true" && !force)
return theTiddler;
template = this.chooseTemplateForTiddler(title,template);
var currTemplate = theTiddler.getAttribute("template");
if((template != currTemplate) || force)
{
var tiddler = store.getTiddler(title);
if(!tiddler)
{
tiddler = new Tiddler();
if(store.isShadowTiddler(title))

tiddler.set(title,store.getTiddlerText(title),config.views.wikified.shadowModifier,version.date,
[],version.date);
else
{
var text = template=="EditTemplate"
? config.views.editor.defaultText.format([title])
: config.views.wikified.defaultText.format([title]);

tiddler.set(title,text,config.views.wikified.defaultModifier,version.date,
[],version.date);
}
}
theTiddler.setAttribute("tags",tiddler.tags.join(" "));
theTiddler.setAttribute("tiddler",title);

/*****************************************************************/
// modif AirCarnet
// titles modifications (as they are sent to urchin)
document.title=title;
var lurlsac="#";
if(title.split(" ")[1]) lurlsac+="[["+title+"]] ";
else lurlsac+=title;
if(window.location.hash!=lurlsac) window.location.hash=lurlsac;
// google count
comptageGoogle(title);
/*******************************************************************/

theTiddler.setAttribute("template",template);
var me = this;
theTiddler.onmouseover = this.onTiddlerMouseOver;
theTiddler.onmouseout = this.onTiddlerMouseOut;
theTiddler.ondblclick = this.onTiddlerDblClick;
theTiddler[window.event?"onkeydown":"onkeypress"] =
this.onTiddlerKeyPress;
var html = this.getTemplateForTiddler(title,template,tiddler);
theTiddler.innerHTML = html;
applyHtmlMacros(theTiddler,tiddler);
if(store.getTaggedTiddlers(title).length > 0)
addClass(theTiddler,"isTag");
else
removeClass(theTiddler,"isTag");
if(!store.tiddlerExists(title))
{
if(store.isShadowTiddler(title))
addClass(theTiddler,"shadow");
else
addClass(theTiddler,"missing");
}
else
{
removeClass(theTiddler,"shadow");
removeClass(theTiddler,"missing");
}
}
}
return theTiddler;
}

4. That's all. Hope this will work. It works for me. If not, visit
this for original coding (comments are in french sorry). Not through
dial up connection! the file is very big now, since load-on-demand is
not implemented ;-)
- http://sylvain.comte.online.fr/AirCarnet/[[MarkupPostHead]]
- http://sylvain.comte.online.fr/AirCarnet/[[ccTiddlySacPersonalisation]]

Sylvain

Ken Girard

unread,
Apr 26, 2007, 10:23:44 PM4/26/07
to TiddlyWiki
Thanks, I will let you know how it works.

Ken Girard

Ken Girard

unread,
Apr 27, 2007, 12:54:44 AM4/27/07
to TiddlyWiki
Works like a dream! In the last 2 hours I've already gotten about 200
tidders being tracked by Google. What is really funny is that it shows
some oddities in what people are choosing to click on. They go for
things I would have thought were never getting seen.

Ken Girard

On Apr 25, 9:54 am, SylvainComte <sylvain.co...@gmail.com> wrote:

Jon

unread,
Apr 27, 2007, 5:32:15 AM4/27/07
to TiddlyWiki
That sounds great, shame my tiddlywiki is only on our company
intranet. Myabe I'll just go to your site instead and click on some
random stuff :)
Reply all
Reply to author
Forward
0 new messages