Simple impression counter?
📋 Description
A badge with just the number of times the badge has been displayed by unique users would be nice. I searched the website but perhaps I am blind and I did not find it.
🔗 Data
just an impression counter.
🎤 Motivation
Lack thereof.
While an interesting idea, I'm not sure it best aligns with project goals. As stated in our contribution guideline badges should present information useful to developers from a documented API.
While some developers might be interested in such counters, there are a few problems here:
- Information is not directly related to developers work.
- Shields depends on an API to provide said info.
- Shields is not built to hold information over time, like the number of requests of an image.
Could you provide info regarding benefits of the badge and API source that it might use?
Could you provide info regarding benefits of the badge and API source that it might use?
Benefits: let's assume I have a badge that tells me how many downloads I had. It would be useful to know how many people visited the "repository main page" (where the readme is displayed. To have a comparison. About the data source, github should have an api for that..
Source: https://github.com/[USER]/[REPO]/graphs/traffic?partial=top_lists
https://github.com/badges/shields/graphs/traffic?partial=top_lists
or:
https://docs.github.com/en/rest/orgs/api-insights?apiVersion=2022-11-28#get-summary-stats
Thank you for the data sources, but there are some limitations here that might render them not suitable for this use case.
Let me start by saying api-insights is not relevant here, as it tracks api usage and not user page views.
regarding the traffic endpoint:
- This view (and API) shows repository page views and unique visitors, as well as referrers and popular content.
- These metrics reflect how many times the GitHub repo itself was visited in a browser, potentially including times when a badge in the README was visible.
- Limitation: It does not count badge impressions outside the GitHub repository (e.g., when badges are embedded on blogs or other sites). It also only covers the last 14 days and requires repo admin permissions to access.
So in short:
- api-insights is not relevant here
- traffic endpoint requires permissions and is very limited in what it provides.