Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Weekly/Monthly/Yearly Hits #14042

Open
ghost opened this issue Apr 23, 2021 · 10 comments
Open

Suggestion: Weekly/Monthly/Yearly Hits #14042

ghost opened this issue Apr 23, 2021 · 10 comments

Comments

@ghost
Copy link

ghost commented Apr 23, 2021

Hey, @cdnjs team. I have a suggesting regarding hits. We can have a item in the api response json regarding hits. JsDelivr also provides an api and It is widely used for badges like jsDelivr hits (GitHub). Likewise If cdnjs.com also has a similar api it would be really useful

@MattIPv4
Copy link
Member

👋 The short answer is that we don't have this data available in the API currently as we avoid doing tracking wherever possible.

@xtuc thoughts on if we can get this data made available in the API?

@ghost
Copy link
Author

ghost commented Apr 23, 2021

@MattIPv4 Hits = No. Of Requests Made. And This Data Would Be There Already I Think?

@MattIPv4
Copy link
Member

We do not have access to hit data in the API, we do not actively track requests through any cdnjs operations.

The only place that this data will exist currently is within Cloudflare's standard logging system.

@ghost
Copy link
Author

ghost commented Apr 23, 2021

I don't know much about cloudflare. But the example I gave also uses cloudflare and many more alike. But still provides the count. I think that cdnjs only uses cloudflare so it might be easy to integrate. I've used jsdelivr before as well when the package I wanted was not there on cdnjs. And it doesn't send any cookies or something else for getting the data. I think that jsdelivr's repo can be a example of implentation of this without the need of tracking or something

@MattIPv4
Copy link
Member

I think you misunderstand what I mean by tracking here -- we do not actively track any metrics on requests that are made to cdnjs in a way that makes data available to us for an API endpoint, including request count.

By the domain going through Cloudflare, they have basic request information logged and we could potentially use that to power an API endpoint to get hits for a library over a time period, but we do not currently have access to that data other than through manual requests that we make once a month for cdnjs/cf-stats.

I defer to @xtuc on if they think it'd be viable to get real-time access to Cloudflare data for an API endpoint, or if it'd be worth the investment to add our own request logging as middleware in a Worker, or if we should just continue to not offer an API endpoint for hits?

@ghost
Copy link
Author

ghost commented May 2, 2021

@xtuc??

@Explosion-Scratch
Copy link

I would only be comfortable if all the data was anonymous, and then somehow opt-outable? (Not sure how that would work but it's something to consider)

@MattIPv4
Copy link
Member

All the data we publish will always be anonymized and aggregated :)

I'm not sure how opt-out would function in this context?

@Explosion-Scratch
Copy link

All the data we publish will always be anonymized and aggregated :)

I'm not sure how opt-out would function in this context?

Possibly noreferrer or something in script tags could be taken as indication the script doesn't count? This could be done server side as well.

@MattIPv4
Copy link
Member

We already set noreferrer on all cdnjs script/link tags -- we don't track anything like that, we just track a total request count for each asset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants