Skip to content

Suggestion: Weekly/Monthly/Yearly Hits #14042

Open

Description

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

Activity

  1. MattIPv4 commented on Apr 23, 2021

    @MattIPv4
    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?

  2. MattIPv4 commented on Apr 23, 2021

    @MattIPv4
    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.

  3. MattIPv4 commented on Apr 23, 2021

    @MattIPv4
    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?

  4. Explosion-Scratch commented on Jun 30, 2021

    @Explosion-Scratch

    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)

  5. MattIPv4 commented on Jun 30, 2021

    @MattIPv4
    Member

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

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

  6. Explosion-Scratch commented on Jun 30, 2021

    @Explosion-Scratch

    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.

  7. MattIPv4 commented on Jun 30, 2021

    @MattIPv4
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions