In this section, you can know how to use the third-party plugin, and calculate how many visitors view your blog and your website
How to Calculate the Number of Views
Busuanzi is a third-party visitor counter and statistics tool that you can use with Hugo to track visitor traffic to your site. Here’s how to set up Busuanzi in Hugo:
-
First, go to the Busuanzi website (https://busuanzi.ibruce.info/) and choose the style of the visitor counter you want to use. You can choose from several different styles and customize the text that appears alongside the counter.
-
Once you’ve selected your counter style, copy the HTML code provided by Busuanzi. This code should look something like this:
|
|
-
In your Hugo project, open the layout file where you want to add the Busuanzi counter. For example, if you want to add the counter to your site’s footer, you might open the footer.html layout file.
-
Paste the Busuanzi HTML code into the layout file where you want the counter to appear. Be sure to replace any existing code in that location, or add it to a new location if you’re creating a new element.
-
Save the layout file and rebuild your Hugo site. The Busuanzi counter should now appear on your site.
Note that Busuanzi is a third-party tool and may have limitations or restrictions on usage depending on your site’s traffic volume. Be sure to read the Busuanzi documentation carefully and follow any usage guidelines or restrictions to avoid any issues with your site’s performance or reliability.
Add busuanzi in Config.toml
|
|
Where to use it?
In footer.html
Go the the footer.html, we add the default html in our custom footer.
|
|
Note id and class you cannot define by yourself, but you can change the icon.
In post page (post_meta.html)
In blog page, we need to know how many users view our article. Go the post_meta.html, Just add only one line.
|
|