matteofigus / npm-stats-www

A website showing npm modules metrics
http://www.npm-stats.com
111 stars 17 forks source link

Fails when twitter is blocked by disconnect or ghostery #3

Closed redchair123 closed 10 years ago

redchair123 commented 10 years ago

The user download count shows up, but the individual package graph fails. The error comes from loadTwitterWidget:

https://github.com/matteofigus/npm-stats-www/blob/master/public/javascripts/views/user.js#L112

  var loadTwitterWidget = function(){
    // Here you should add a line like
    // if(typeof twttr === 'undefined') return;
    twttr.ready(function(twttr) {       
      twttr.events.bind('tweet', function (event) {
        _gaq.push(['_trackEvent', "Engagement", "Share-Twitter", username]);
      });
      twttr.widgets.load();
    });
  };
matteofigus commented 10 years ago

good spot, thanks. I'll try to fix it asap.