Skip to content

Get a repo's traffic views

Read how many page views a repository has had over GitHub’s 14-day rolling window, broken down by day.

  1. Call get_repo_traffic_views with the repository’s owner and name:

    get_repo_traffic_views { owner: "octocat", repo: "example" }
  2. Read the totals off the top-level fields, and the day-by-day breakdown off daily:

    {
    "count": 512,
    "uniques": 71,
    "daily": [
    { "timestamp": "2026-06-22T00:00:00Z", "count": 40, "uniques": 12 }
    ]
    }

    count is total views in the window; uniques is unique visitors. daily has one entry per day GitHub reported; if GitHub’s response omits the views array entirely, this tool returns daily: [] rather than failing.

  • missing_scope: no GitHub token was resolvable. Set GITHUB_TOKEN or run gh auth login.
  • github_api_error with a 403: check whether it’s a genuine permission problem (you need push access to the repository to read its traffic) — a rate-limited 403 is retried automatically up to three times before this error surfaces, so if you see it, it isn’t a rate limit that will clear on its own.