{"id":13989790,"url":"https://github.com/doowb/github-traffic","last_synced_at":"2025-10-23T20:22:28.896Z","repository":{"id":65990616,"uuid":"68390593","full_name":"doowb/github-traffic","owner":"doowb","description":"Get the Github traffic for the specified repository","archived":false,"fork":false,"pushed_at":"2016-09-16T23:03:25.000Z","size":22,"stargazers_count":81,"open_issues_count":0,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-30T14:04:28.567Z","etag":null,"topics":["analytics","api","github","github-analytics","github-api","github-statistics","github-stats","github-traffic","statistics","stats","traffic","traffic-information"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doowb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["doowb","jonschlinkert"]}},"created_at":"2016-09-16T15:14:38.000Z","updated_at":"2024-01-04T16:07:38.000Z","dependencies_parsed_at":"2023-03-10T23:26:55.604Z","dependency_job_id":null,"html_url":"https://github.com/doowb/github-traffic","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"eb0ec85911bf899d051ee361a5235a85935d6367"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-traffic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-traffic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-traffic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fgithub-traffic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/github-traffic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666130,"owners_count":21624290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","api","github","github-analytics","github-api","github-statistics","github-stats","github-traffic","statistics","stats","traffic","traffic-information"],"created_at":"2024-08-09T13:02:04.072Z","updated_at":"2025-10-23T20:22:23.852Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","readme":"# github-traffic [![NPM version](https://img.shields.io/npm/v/github-traffic.svg?style=flat)](https://www.npmjs.com/package/github-traffic) [![NPM downloads](https://img.shields.io/npm/dm/github-traffic.svg?style=flat)](https://npmjs.org/package/github-traffic) [![Build Status](https://img.shields.io/travis/doowb/github-traffic.svg?style=flat)](https://travis-ci.org/doowb/github-traffic)\n\nGet the Github traffic for the specified repository\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save github-traffic\n```\n\n## Usage\n\n```js\nvar traffic = require('github-traffic');\n```\n\n## API\n\n### [traffic](index.js#L57)\n\nGet the last 14 days (this is Github's limitation) of Github traffic for the specified repository. The results will contain 4 keys (one for each of the traffic endpoints specified in the [api documentation](https://developer.github.com/v3/repos/traffic/)). See the [example results](/example-results.json) for the expanded results from the example. See the other methods below to get results for a specific endpoint.\n\n**Params**\n\n* `repo` **{String}**: Full repository to get traffic, formatted as `:owner/:repo`. If the repository is published to NPM, the NPM name may be used.\n* `options` **{Object}**: Options containing the Github authentication information. This is required since user's must be administrators on the repository to retrieve traffic information.\n* `options.username` **{String}**: Github username of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.password` **{String}**: Github user's password of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.token` **{String}**: Github oauth token for the repository administrator retrieving the traffic informatino. This is required if the `username/password` combination is not used.\n* `cb` **{Function}**: Optional callback function that will be called with error information or the results. When omitted a Promise is returned.\n* `returns` **{Promise}**: Promise with the traffic information when ready.\n\n**Example**\n\n```js\nvar options = {\n  username: 'doowb',\n  password: '**********'\n};\n\ntraffic('assemble/assemble', options, function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n  //=\u003e {\n  //=\u003e   referrers: [ ... ],\n  //=\u003e   paths: [ ... ],\n  //=\u003e   views: {\n  //=\u003e     count: 4043,\n  //=\u003e     uniques: 1155,\n  //=\u003e     views: [ ... ]\n  //=\u003e   },\n  //=\u003e   clones: {\n  //=\u003e     count: 47,\n  //=\u003e     uniques: 38,\n  //=\u003e     clones: [ ... ]\n  //=\u003e   }\n  //=\u003e }\n});\n```\n\n### [.referrers](index.js#L116)\n\nGet [referrers](https://developer.github.com/v3/repos/traffic/#list-referrers) for the specified repository from the Github traffic api.\n\n**Params**\n\n* `repo` **{String}**: Full repository to get traffic, formatted as `:owner/:repo`. If the repository is published to NPM, the NPM name may be used.\n* `options` **{Object}**: Options containing the Github authentication information. This is required since user's must be administrators on the repository to retrieve traffic information.\n* `options.username` **{String}**: Github username of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.password` **{String}**: Github user's password of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.token` **{String}**: Github oauth token for the repository administrator retrieving the traffic informatino. This is required if the `username/password` combination is not used.\n* `cb` **{Function}**: Optional callback function that will be called with error information or the results. When omitted a Promise is returned.\n* `returns` **{Promise}**: Promise with the traffic information when ready.\n\n**Example**\n\n```js\nvar options = {\n  username: 'doowb',\n  password: '**********'\n};\n\ntraffic.referrers('assemble/assemble', options, function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n  //=\u003e [\n  //=\u003e   { referrer: 'Google', count: 765, uniques: 377 },\n  //=\u003e   ...\n  //=\u003e ],\n});\n```\n\n### [.paths](index.js#L153)\n\nGet [paths](https://developer.github.com/v3/repos/traffic/#list-paths) for the specified repository from the Github traffic api.\n\n**Params**\n\n* `repo` **{String}**: Full repository to get traffic, formatted as `:owner/:repo`. If the repository is published to NPM, the NPM name may be used.\n* `options` **{Object}**: Options containing the Github authentication information. This is required since user's must be administrators on the repository to retrieve traffic information.\n* `options.username` **{String}**: Github username of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.password` **{String}**: Github user's password of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.token` **{String}**: Github oauth token for the repository administrator retrieving the traffic informatino. This is required if the `username/password` combination is not used.\n* `cb` **{Function}**: Optional callback function that will be called with error information or the results. When omitted a Promise is returned.\n* `returns` **{Promise}**: Promise with the traffic information when ready.\n\n**Example**\n\n```js\nvar options = {\n  username: 'doowb',\n  password: '**********'\n};\n\ntraffic.paths('assemble/assemble', options, function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n  //=\u003e [\n  //=\u003e   {\n  //=\u003e     path: '/assemble/assemble',\n  //=\u003e     title: 'GitHub - assemble/assemble: Static site generator and rapid prototyping frame...',\n  //=\u003e     count: 1551,\n  //=\u003e     uniques: 839\n  //=\u003e   },\n  //=\u003e   ...\n  //=\u003e ],\n});\n```\n\n### [.views](index.js#L186)\n\nGet [views](https://developer.github.com/v3/repos/traffic/#views) for the specified repository from the Github traffic api.\n\n**Params**\n\n* `repo` **{String}**: Full repository to get traffic, formatted as `:owner/:repo`. If the repository is published to NPM, the NPM name may be used.\n* `options` **{Object}**: Options containing the Github authentication information. This is required since user's must be administrators on the repository to retrieve traffic information.\n* `options.username` **{String}**: Github username of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.password` **{String}**: Github user's password of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.token` **{String}**: Github oauth token for the repository administrator retrieving the traffic informatino. This is required if the `username/password` combination is not used.\n* `cb` **{Function}**: Optional callback function that will be called with error information or the results. When omitted a Promise is returned.\n* `returns` **{Promise}**: Promise with the traffic information when ready.\n\n**Example**\n\n```js\nvar options = {\n  username: 'doowb',\n  password: '**********'\n};\n\ntraffic.views('assemble/assemble', options, function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n  //=\u003e {\n  //=\u003e   count: 4043,\n  //=\u003e   uniques: 1155,\n  //=\u003e   views: [ ... ]\n  //=\u003e }\n});\n```\n\n### [.clones](index.js#L219)\n\nGet [clones](https://developer.github.com/v3/repos/traffic/#clones) for the specified repository from the Github traffic api.\n\n**Params**\n\n* `repo` **{String}**: Full repository to get traffic, formatted as `:owner/:repo`. If the repository is published to NPM, the NPM name may be used.\n* `options` **{Object}**: Options containing the Github authentication information. This is required since user's must be administrators on the repository to retrieve traffic information.\n* `options.username` **{String}**: Github username of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.password` **{String}**: Github user's password of the repository administrator retrieving the traffic information. This is required if an oauth token is not used.\n* `options.token` **{String}**: Github oauth token for the repository administrator retrieving the traffic informatino. This is required if the `username/password` combination is not used.\n* `cb` **{Function}**: Optional callback function that will be called with error information or the results. When omitted a Promise is returned.\n* `returns` **{Promise}**: Promise with the traffic information when ready.\n\n**Example**\n\n```js\nvar options = {\n  username: 'doowb',\n  password: '**********'\n};\n\ntraffic.clones('assemble/assemble', options, function(err, results) {\n  if (err) return console.error(err);\n  console.log(results);\n  //=\u003e {\n  //=\u003e   count: 47,\n  //=\u003e   uniques: 38,\n  //=\u003e   clones: [ ... ]\n  //=\u003e }\n});\n```\n\n## About\n\n### Related projects\n\n* [get-repository-url](https://www.npmjs.com/package/get-repository-url): Get the GitHub repository URL from a NPM package name. | [homepage](https://github.com/jonschlinkert/get-repository-url \"Get the GitHub repository URL from a NPM package name.\")\n* [github-base](https://www.npmjs.com/package/github-base): JavaScript wrapper that greatly simplifies working with GitHub's API. | [homepage](https://github.com/jonschlinkert/github-base \"JavaScript wrapper that greatly simplifies working with GitHub's API.\")\n* [parse-github-url](https://www.npmjs.com/package/parse-github-url): Parse a github URL into an object. | [homepage](https://github.com/jonschlinkert/parse-github-url \"Parse a github URL into an object.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d \u0026\u0026 npm test\n```\n\n### Author\n\n**Brian Woodward**\n\n* [github/doowb](https://github.com/doowb)\n* [twitter/doowb](http://twitter.com/doowb)\n\n### License\n\nCopyright © 2016, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT license](https://github.com/doowb/github-traffic/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.30, on September 16, 2016._","funding_links":["https://github.com/sponsors/doowb","https://github.com/sponsors/jonschlinkert"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgithub-traffic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fgithub-traffic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fgithub-traffic/lists"}