Google Analytics Link Reference (html5)

Discussion in 'Web Design and Development' started by miknos, Nov 20, 2010.

  1. miknos Suspended

    miknos

    Joined:
    Mar 14, 2008
    #1
    It is possible to use reference link in Google Analytics?

    Let's say <link rel="javascript" href="analytics.js"> instead of:

    <script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-912730-5']);
    _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);
    })();

    </script>
     
  2. kingthias macrumors member

    Joined:
    Feb 11, 2009
    #2
    Yes I did this. It works perfectly fine and I linked it to all of my pages and it identifies them as different pages in analytics still.
     
  3. miknos thread starter Suspended

    miknos

    Joined:
    Mar 14, 2008
    #3
    Thanks for answering.

    Nice to know code can get even cleaner that way.
     

Share This Page