https://github.com/kidgodzilla/live-counter
A live mjpeg counter that you can embed in your website
https://github.com/kidgodzilla/live-counter
counter express hit hit-counter javascript live mjpeg node
Last synced: 2 months ago
JSON representation
A live mjpeg counter that you can embed in your website
- Host: GitHub
- URL: https://github.com/kidgodzilla/live-counter
- Owner: kidGodzilla
- License: mit
- Created: 2020-09-29T09:12:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T05:48:52.000Z (about 2 years ago)
- Last Synced: 2025-03-17T04:43:53.521Z (over 1 year ago)
- Topics: counter, express, hit, hit-counter, javascript, live, mjpeg, node
- Language: HTML
- Homepage: https://hits.serv.rs/
- Size: 96.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Live Counter
A live JPEG or [MJPEG](https://en.wikipedia.org/wiki/Motion_JPEG) hit counter that you can embed in your website.
## Demo
View a live demo at: https://hits.serv.rs/

## How it Works
1. Each request serves an image that displays the number of requests made to that specific image.
2. You can choose either a `live` or `static` image. The `live` image is served as `mjpeg`, a format which can be updated continuously after the page load is complete.
3. The image can be customized by changing the default font, and colors.
## Installation
You can install the source for this server by downloading this repository, and running `npm install`.
## Usage
Each instance of the counter you embed on a website should have a unique ID. It can be anything (up to 20 characters) -- we don't pick that for you. It could be something programmatic like `md5(location.hostname)` a GUID, numeral Id (`12345`), or any other url-safe string you like (like `foo%20bar`).
```html
```
## Customization
You can customize the widget by passing parameters, like:
```html
```
## Embedding a static image
If you don't want to use a live image, you can use a static one, like:
```html
```
---
Inspired by these blog posts:
https://underjord.io/live-server-push-without-js.html
[[Discuss on HN]](https://news.ycombinator.com/item?id=24613610)
--
https://joshwcomeau.com/react/serverless-hit-counter/
[[Discuss on HN]](https://news.ycombinator.com/item?id=24617086)