Is it possible to track views and clones of my github repositories

前端 未结 2 1176
日久生厌
日久生厌 2020-12-24 06:50

Just wondering if there is any Analytics type things available for github. I\'d be curious to know who is viewing / using my code, if anyone...

2条回答
  •  时光说笑
    2020-12-24 07:46

    Update August 2014:

    The Traffic graph now includes the number of clones: See "Clone Graphs"

    https://cloud.githubusercontent.com/assets/395621/3867646/2c340b8a-2009-11e4-8823-9ffffda44b51e0.png

    The 2020 documentation states:

    Anyone with push access to a repository can view its traffic, including full clones (not fetches), visitors from the past 14 days, referring sites, and popular content in the traffic graph.


    All the information are mainly available through the (newly refurbished) User page.

    But you can query some of those data through the Github API for users, as described in "How I built my blog in one day"

    I wanted to have a button with my number of GitHub followers and GitHub repositories that was dynamic.
    GitHub provides an api of each users information:

    jQuery(document).ready(function() {
    
            $('#gf').text('GitHub Followers');
            $('#gfr').text('GitHub Repos'); 
    
    $.get('https://api.github.com/users/erjjones', function(res) {
    var obj = jQuery.parseJSON(res);    
    if(typeof obj.followers != 'undefined') 
    {   
    $('#gf').text(obj.followers + ' GitHub Followers');
    $('#gfr').text(obj.public_repos + ' GitHub Repos'); 
    }   
        }); 
    });
    

提交回复
热议问题