Home

Awesome

github-traffic NPM version NPM downloads Build Status

Get the Github traffic for the specified repository

Install

Install with npm:

$ npm install --save github-traffic

Usage

var traffic = require('github-traffic');

API

traffic

Get 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). See the example results for the expanded results from the example. See the other methods below to get results for a specific endpoint.

Params

Example

var options = {
  username: 'doowb',
  password: '**********'
};

traffic('assemble/assemble', options, function(err, results) {
  if (err) return console.error(err);
  console.log(results);
  //=> {
  //=>   referrers: [ ... ],
  //=>   paths: [ ... ],
  //=>   views: {
  //=>     count: 4043,
  //=>     uniques: 1155,
  //=>     views: [ ... ]
  //=>   },
  //=>   clones: {
  //=>     count: 47,
  //=>     uniques: 38,
  //=>     clones: [ ... ]
  //=>   }
  //=> }
});

.referrers

Get referrers for the specified repository from the Github traffic api.

Params

Example

var options = {
  username: 'doowb',
  password: '**********'
};

traffic.referrers('assemble/assemble', options, function(err, results) {
  if (err) return console.error(err);
  console.log(results);
  //=> [
  //=>   { referrer: 'Google', count: 765, uniques: 377 },
  //=>   ...
  //=> ],
});

.paths

Get paths for the specified repository from the Github traffic api.

Params

Example

var options = {
  username: 'doowb',
  password: '**********'
};

traffic.paths('assemble/assemble', options, function(err, results) {
  if (err) return console.error(err);
  console.log(results);
  //=> [
  //=>   {
  //=>     path: '/assemble/assemble',
  //=>     title: 'GitHub - assemble/assemble: Static site generator and rapid prototyping frame...',
  //=>     count: 1551,
  //=>     uniques: 839
  //=>   },
  //=>   ...
  //=> ],
});

.views

Get views for the specified repository from the Github traffic api.

Params

Example

var options = {
  username: 'doowb',
  password: '**********'
};

traffic.views('assemble/assemble', options, function(err, results) {
  if (err) return console.error(err);
  console.log(results);
  //=> {
  //=>   count: 4043,
  //=>   uniques: 1155,
  //=>   views: [ ... ]
  //=> }
});

.clones

Get clones for the specified repository from the Github traffic api.

Params

Example

var options = {
  username: 'doowb',
  password: '**********'
};

traffic.clones('assemble/assemble', options, function(err, results) {
  if (err) return console.error(err);
  console.log(results);
  //=> {
  //=>   count: 47,
  //=>   uniques: 38,
  //=>   clones: [ ... ]
  //=> }
});

About

Related projects

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for avice on opening issues, pull requests, and coding standards.

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Brian Woodward

License

Copyright © 2016, Brian Woodward. Released under the MIT license.


This file was generated by verb-generate-readme, v0.1.30, on September 16, 2016.