A simple metrics collection of Web Monetization events in relation to tracking page revenue.
The goal of this project is capture web monetization progress events and store them to review at what pages generate the most revenue. Currently, the idea would be to store these metrics in Postgres and to use Grafana to visualize the data. Ideally, in the future, I'd like to be able to have a custom dashboard, which would query the API for the data, and to utilize Redis PubSub to stream the data in real time.
Web Monetization (WM) is a proposed API standard that allows websites to request a stream of very small payments (e.g. fractions of a cent) from a user.
Here is the web monetization explainer.
The goal is to showcase the value of web monetization and to attribute or correlate performance of monetization to content. With this in mind, for future potential features or pull request submissions, we will always respect the user's privacy and prohibit the collection of user data.
A client, the browser, will open a web sockets connection with the metrics server and stream the incoming event.details
objects to the server. This is not the most ideal strategy, because it would require a sticky session to a particular service.
Other considerations that I've had for this was to use the following:
- Redis PubSub
- RabbitMQ
- gRPC (unfortunately, would also sticky session)
If there is a better approach, please submit a proposal via an issue.
Dependencies:
- Docker
- Postgres (or available in docker-compose)
- Grafana (or available in docker-compose)
- Go (this project was built on 1.15)
- Fork the project
- Install dependencies:
go mod download
go mod verify
- To run the project dependencies:
docker-compose up
- To run the mock client to feed/fake monetization data:
docker-compose -p wm_analytics -f docker-compose.yml -f docker-compose.dev.yml up --build -d
- Submit PR.