\footnote{}

Aller au contenu | Aller au menu | Aller à la recherche

lundi, septembre 21 2009

Disabling Google Analytics for tests/development in a nutshell

A very simple way to disable Google Analytics when you don’t want your visit to be registered (for instance when you’re working on your CSS or making a page with a template that embed the GA tracker) : just add a variable to load the tracker (or not) depending on the context :

Here’s my version :

<script type="text/javascript">
  var testmode=false;
  if(/taiste.acadis.org/.test(window.location.host)
      || /.*admin.*/.test(window.location.pathname)
      || /.*noga.*/.test(window.location.search)
      || /.*noga.*/.test(window.location.hash))
    testmode=true;


  if(!testmode){
    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
   }
</script>
<script type="text/javascript">
 if(!testmode){
   try {
     var pageTracker = _gat._getTracker("...");
      ageTracker._trackPageview();
   } catch(err) {}
  }
</script>

Here, GA won’t be loaded for urls like example.com#noga, test.example.com and so on…

dimanche, mai 24 2009

DAS - a Deezer to Last.fm compatibility bridge

If, like me, you used Last.fm quite often to… well basically know what you listen and discover other things to listen but you are know more using streaming platforms like Deezer.com than regular music players, you may regret that there is still no compatibility between theses.

Then if you want an up-to-date Last.fm profile while using Deezer I may have something for you.

Lire la suite...