A service about badge generator to count visitors of your site (based on counter-service and shields.io).
There is a simple management panel here: management-panel.
parameter | value |
---|---|
?namespace | usually a domain name, like: plantree.me |
?key | usually a relative URL path, like: about.html |
?label | left text in the badge, default: visitors |
?labelColor | left color in the badge |
?color | right color in the badge |
?style | just like styles in shields.io |
Styles examples:
?style=flat-square&logo=appveyor
?style=for-the-badge&logo=appveyor
-
The default badge:
https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html
-
Change a style:
https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html&style=for-the-badge
-
Change colors:
https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html&color=blue
I am running a personal website, which is plantree.me, and I need a way to count the number of visitors.
Currently, there are some ready-made service to do this, just like: visitor-badge, HITS, etc. However, like I have post in counter, there is no clear decoupling of presentation service and data service. That's why I develop two separate services:
- data service
- presentation service (this project)
You can use them independently and they all have clear documentations and interfaces for ease of use.
Component | Implementation |
---|---|
runtime | Vercel Serverless |
dependency services | counter-service & shieds.io |
sequenceDiagram
Client->>VisitorBadgeService: request with parameters
VisitorBadgeService->>CounterService: incr value
CounterService->>VisitorBadgeService: get value
VisitorBadgeService->>ShieldsService: generate badge
ShieldsService->>Client: response
Client->>Client: present
- basic service is ready
- deploy to Vercel Serverless