MoonCountrer - Fast & Powerful Website Visitor Counter
Category: Programming
Moon Counter
A fast, simple & easy-to-use webpage visitor counter, but not only limited to websites.
đ CORS support
With a visual admin panel
text & image output
Rule34 Theme Preview:
Moebooru Preview
This Page Views
Project repo
Admin panel
Preview at https://counter.moonlab.top/admin. The password is 123456.
Public Counter
You can use my MoonCounter instance as you want. But I donât have responsibility for its stablility. In fact, no one does. But as long as this website continues, the counter service is always public.
But i still recommand you self-host your owned service.
Ofc, the use of my service is prohibited for illegal websites.
Image Counter
Replace the UniqueID parameter with the webpageâs url. At least it must be unique to identify your page.
![](https:///counter.moonlab.top/counter/img?id=UniqueID)
<img src="//counter.moonlab.top/counter/img?id=UniqueID"></img>
If you donât wanna handle UniqueID by yourself, you can use this.
<script src="//counter.moonlab.top/moon-counter/js/img"></script>
<img id="moon-counter-img"></img>
It will automatically handle the id param. You can just directly put it on your webpage to count.
Text Counter
And this will only output plain count text. You also donât need to handle the uniqueid parameter by yourself.
<script src="//counter.moonlab.top/moon-counter/js"></script>
<span id="moon-counter"></span>
Self Host
Download the release file. Replace the following verison v0.0.1
with the latest version. You can get it from Github Release
wget https://github.com/HelloLingC/moon-counter/releases/download/v0.0.1/moon-counter-v0.0.1-linux-amd64.tar.gz
Decompress.
tar -xf moon-counter-v0.0.1-linux-amd64.tar.gz
Configure >> Configuration Details
vi config.yaml
Configure daemon process. This is a service template for systemd
[Unit]
Description=Moon Counter service
Wants=network.target
After=network.target network.service
[Service]
Type=simple
WorkingDirectory=/opt/counter
ExecStart=/opt/counter/moon-counter
KillMode=process
Configure reverse proxy. This is a template for nginx
server {
listen 80;
server_name counter.moonlab.top
location {
proxy_pass http://127.0.0.1:3800
proxy_pass_request_headers on;
}
}
Configuration
You can use -c
to specify the path of config file, eg: moon-counter -c custom.yml
By default, the configuration file is named as config.yaml
, which is located in the root directory of the programâs binary file.
host: counter.moonlab.top
listen: 3800
img_theme: rule34
cors: true
hostnames:
 - moonlab.top
error_log: error.log
db:
 type: sqlite
 dbname: moon.db
 host:
 username:
 password:
admin:
 enable: false
 path: /admin
 password:
host - The counter serverâs domain. If you donât have a domain for your server, replace this with your external IP and server listening port. eg: 201.25.21.3:3800
listen - The server listening port. Itâs always better to use with reverse proxy.
img_theme - The theme name for image mode. You can add your own theme under the assets folder. And modify this variable with your theme folder name.
cors - CORS mode for security. Once enabled, others cannot use your counter server to tally views for their websites without your permission. And thus, hostnames
is required. For more details about CORS, see Cross-Origin Resource Sharing (CORS) - HTTP | MDN (mozilla.org).
hostnames - Only when cors is enabled. A array of allowed hostnames.
error_log - currently not available
db
type - currently only support sqlite
dbname - For SQLite, dbname is the filename.
admin
enable - Enable admin panel or not. If admin panel is not enabled, the admin panel will disguise as 404 error page.
path - The path to the admin panel. You must set a random string for it, instead of /admin
.
passphrase - You should use a generator to generate a random string, either passphrase or password. For passphrase generating, try Use a Passphrase.
Philosophy
Only Do One Thing For the Best
Moon Couner is only for pageview counting.
Your website will create a history and precious memories for you, and for this, A pageview counter is the best way to store it forever.
If youâre looking for website analytics service, I recommand you GoatCounter â open source web analytics
Credits
The resources (images) used in MoonCounter are not owned by me. All the resources belong to their respective owners. I do NOT claim any ownership. USE AT YOUR OWN RISK.
WARNING: NSFW Content. The following external links may contain NSFW content.
Rule34 - Rule 34, if it exist there is porn of it.
Moebooru = moebooru/app at master · moebooru/moebooru (github.com)