MediaWiki:Common.js: mudanças entre as edições

Google Analytics
Sem resumo de edição
 
(Uma revisão intermediária pelo mesmo usuário não está sendo mostrada)
Linha 8: Linha 8:


   gtag('js', new Date());
   gtag('js', new Date());
  gtag('config', 'G-K10YXH7MPV');


  setTimeout(function() {
}
    gtag('config', 'G-K10YXH7MPV');
  }, 500);


}
document.addEventListener('click', function(e) {
  var link = e.target.closest('a');
  if (!link) return;
 
  if (link.hostname !== location.hostname) {
    gtag('event', 'click_externo', {
      'event_category': 'link',
      'event_label': link.href
    });
  }
});
 
document.addEventListener('click', function(e) {
  var link = e.target.closest('a');
  if (!link) return;
 
  if (link.href.match(/\.(pdf|zip|doc|jpg)$/i)) {
    gtag('event', 'download', {
      'event_category': 'arquivo',
      'event_label': link.href
    });
  }
});