Return to Snippet

Revision: 17039
at August 21, 2009 10:00 by chrisjlee


Initial Code
<!-- Google Analytics -->
    <script type="text/javascript" language="Javascript1.2">
      var gaJsHost = (("https:" == document.location.protocol) ? " https://ssl." : "http://www.");
      document.write("<" + "script type='text/javascript' src='" + gaJsHost + "google-analytics.com/ga.js'><" + "/script>");
    </script>
    <script type="text/javascript" language="Javascript" name="Google Analytics">
      function v_ga_track(ga_account, trackDomainName, theDomainName){
          var domainNameTracking = trackDomainName ? true : false;
          var pageTracker = _gat._getTracker(ga_account);
          pageTracker._initData();
          
          if (domainNameTracking) {
              if (!theDomainName) {
                  theDomainName = "Config_FullStoreURL".replace("https:", "").replace("http:", "");
                  theDomainName = theDomainName.substring(2, theDomainName.length - 1);
              }
              pageTracker._setDomainName(theDomainName);
          }
          pageTracker._trackPageview();
          try {
              pageTracker._addTrans(Order[0], "", Order[2], Order[4], Order[5], Order[6], Order[7], Order[8]);
              for (var i = 0; i < OrderDetails.length; i++) 
                  pageTracker._addItem(OrderDetails[i][0], OrderDetails[i][2], OrderDetails[i][3], OrderDetails[i][4], OrderDetails[i][5], OrderDetails[i][6]);
              pageTracker._trackTrans();
          } 
          catch (e) {
          }
      }
      
      v_ga_track("***CHANGE ME****");
    </script>

Initial URL

                                

Initial Description
Make sure you change the variable v_ga_track near the end of the script.

Initial Title
Google Analytics Code (newest)

Initial Tags
javascript, html, google

Initial Language
JavaScript