4

I want to obtain information about the number of times my projects have been viewed, cloned and where the traffic came from (individually).

I can currently view this Traffic information by clicking on the Insights button of the repository (via the web interface).

Is there a schema in the GitHub v4 GraphQL API to retrieve this information?

The closest I got was the following; nodes didn't contain any sort of statistical data:

{
  viewer {
    repositories(first: 100) {
      totalCount
      nodes {
        name
        description

      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
// response


{
  "data": {
    "viewer": {
      "repositories": {
        "totalCount": 55,
        "nodes": [
          {
            "name": "Repo Name",
            "description": "Repo Description"
          },
          {
            ...
          }
      }
    }
  }
}
nopassport1
  • 1,821
  • 1
  • 25
  • 53

1 Answers1

0

Currently it is not possible to retrieve traffic information using GraphQL API (as explained in here).
Alternately you can use REST API v3 as described in GitHub documentation.

Please notice that reviewing traffic requires tokens with push permissions to the desired repositories.

ze'ev han
  • 13
  • 1