1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can someone tell me what this does?

Discussion in 'General Scripting Chat' started by emerica1184, Feb 16, 2011.

  1. emerica1184

    emerica1184 Jr. VIP Jr. VIP Premium Member

    Joined:
    Jan 6, 2011
    Messages:
    331
    Likes Received:
    79
    Was viewing source info for someones site and saw this

    Code:
    <script type="text/javascript">
    
    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">
    
    try {
    
    var pageTracker = _gat._getTracker("UA-12705194-6");
    
    pageTracker._trackPageview();
    
    } catch(err) {}</script> 
     
  2. squark

    squark Junior Member

    Joined:
    May 22, 2008
    Messages:
    156
    Likes Received:
    1,207
    It's google analytics loading it's tracking script.

    The first part is just make sure and get the right script scheme (http or https) so the visitor doesn't get security dialogs.

    The second part dynamically writes the script tag to the page.

    The third part tracks the page.
     
    Last edited: Feb 16, 2011