Skip to content

Analytics

Filipe Fortes edited this page Feb 7, 2011 · 2 revisions

Google Analytics

This script loads Google Analytics asynchronously and sets it up to track article changes as page views.

  var _gaq = _gaq || [];
  // Edit to add your tracking ID
  _gaq.push(['_setAccount', 'UA-XXXXXXX-XX']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

  (function() {
    // Track article changes as page views
    treesaver.addListener(document, 'treesaver.articlechanged', function (e) {
      _gaq.push(['_trackPageview', e.path]);
    });
  })();
Clone this wiki locally