View count is available

Published: less than 1 minute read, with 128 words. Post views:

As you can see in the subtitle of this post, as well as the bottom-right corner of the homepage, view counts for this site and for individual posts are now available.

Just like the comment function, to have view counts on a static page require external services. We use 不蒜子, with tutorials here. It is quiet easy to use, with only two steps:

  1. Add a js script to every page, like this.
  2. Add a span element to the html to show page counts, like this.

Please note that some browsers will prohibit cross-site tracking (e.g. Safari browser) which will cause inaccurate page view counts. This can’t be fixed at the website side, instead you have to configure manually following this. Some related discussions are available here and here.


Tags: ,

Categories:

Comments