visitor-badge

0. Simple description

A service about badge generator to count visitors of your site (based on counter-serviceopen in new window and shields.ioopen in new window).

1. How to use

1.1 register a namespace in counter-service to help manage your data

There is a simple management panel here: management-panelopen in new window.

1.2 request visitor-badge
1.2.1 query parameters(almost the same with counter-service and shields.ioopen in new window)
parametervalue
?namespaceusually a domain name, like: plantree.meopen in new window
?keyusually a relative URL path, like: about.html
?labelleft text in the badge, default: visitors
?labelColorleft color in the badge
?colorright color in the badge
?stylejust like styles in shields.ioopen in new window

Styles examples:

?style=plastic&logo=appveyorplastic

?style=flat&logo=appveyorflat

?style=flat-square&logo=appveyorflat-square

?style=for-the-badge&logo=appveyorfor-the-badge

?style=social&logo=appveyorsocial

1.2.2 different ways of using
  • The default badge:

    https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html

    default

  • Change a style:

    https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html&style=for-the-badge

    style

  • Change colors:

    https://api.visitor.plantree.me/visitor-badge/pv?namespace=example.com&key=index.html&color=blue

    color

2. Why do this

I am running a personal website, which is plantree.meopen in new window, and I need a way to count the number of visitors.

Currently, there are some ready-made service to do this, just like: visitor-badgeopen in new window, HITSopen in new window, etc. However, like I have post in counteropen in new window, there is no clear decoupling of presentation service and data service. That's why I develop two separate services:

You can use them independently and they all have clear documentations and interfaces for ease of use.

3. Technology inside

3.1 stack
ComponentImplementation
runtimeVercel Serverless
dependency servicescounter-service & shieds.ioopen in new window
3.2 process

4. Changelogs

0.9.0 (2022-12-26)
Feature
  1. basic service is ready
  2. deploy to Vercel Serverless

5. Reference

  1. https://github.com/jwenjian/visitor-badge#readmeopen in new window
  2. https://github.com/dwyl/hitsopen in new window
  3. https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/pythonopen in new window
  4. https://github.com/vercel/examples/tree/main/python/flaskopen in new window
  5. https://shields.io/open in new window