shields icon indicating copy to clipboard operation
shields copied to clipboard

Simple impression counter?

Open 0wwafa opened this issue 7 months ago • 3 comments

📋 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.

0wwafa avatar Jul 23 '25 22:07 0wwafa

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:

  1. Information is not directly related to developers work.
  2. Shields depends on an API to provide said info.
  3. 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?

jNullj avatar Jul 26 '25 19:07 jNullj

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

0wwafa avatar Jul 27 '25 13:07 0wwafa

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.

jNullj avatar Jul 27 '25 18:07 jNullj