Marcel Kapfer

Getting some stats from WriteFreely


224 words, ~ 2 min reading time

selfhosting writefreely plausible

Note: This was initially published on Scribbles, my previous “micro blog”. I discontinued it and moved the contents into this blog on 2023-12-05.

Out of pure curiosity I want to get a few stats from this WriteFreely instance using my self-hosted Plausible instance. But at the current point it does not seem to be too easy to add custom JavaScript or arbitrary HTML to WriteFreely.

But there is a templates folder in the installation directory which contains some more or less well named .tmpl files. Sadly there is not documentation available at this point. But after a bit of playing around, I found out that it seems to be enough, to adjust the following template files:

To not collect views from myself I looked a bit around and found promising boolean name .isOnwer. This, combined with the script tag as generated by Plausible, resulted in the following three lines which I added to the three above mentioned files:

{{ if not .IsOwner }}
    <script defer data-domain="" src=""></script>
{{ end }}

A few tests show that this apparently works.

I should mention that it requires a self-hosted WriteFreely instance (in single user mode) and a good memory to not override/adjust the template files after the next WriteFreely update…

I would like to hear what you think about this post. Feel free to write me a mail!

Reply by mail