wong2

Posted on Jan 13, 2022Read on Mirror.xyz

A method to add visit stats for Mirror posts

The lack of post stats is a common feature request of Mirror, in this article I’ll introduce a solution for this.

The theory is simple: Mirror allows you to add image via a remote url, and when the post is visited, the image will be loaded from that url, so the server hosts the image knowns how many users visited the post.

One service provides such analytics via image is GoatCounter, we’ll use it as an example:

First, sign up GoatCounter:

Remember the code you input, it’ll be used in the following steps. For example, the code I choose is wong2, so I’ll be redirected to https://wong2.goatcounter.com

Then you can add analytics image to your mirror post. The image endpoint format is https://[my-code].goatcounter.com/count?p=[path] .

So if I’d like to add analytic to this post, I can use a image url like: https://wong2.goatcounter.com/count?p=/mirror-post-stats

Embed an image at the end of your post like this:

And you’re done! You can go to GoatCounter to see analytics of post views now.

Mirror