Announcement

Collapse
No announcement yet.

Updated Google Analytics Code (will it work)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Updated Google Analytics Code (will it work)

    I couldn't find an answer to this so thought i'd ask...

    Google analytics have updated their tracking code recently (v10 still using old code)

    Question is will this new code from google work

    NEW:
    Code:
    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _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);
      })();
    
    </script>

    OLD:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleAnalyticsEnabled%22%20%2f%3e%20%3d%3d%20true" >
          <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">
          if (typeof(_gat) == 'object')
              {
              var pageTracker = _gat._getTracker("<actinic:variable name="GoogleAnalyticsNumber" />");
              pageTracker._initData();
              pageTracker._trackPageview(<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">"/receipt.html"</actinic:block>);
              }
          </script>
          </actinic:block>

    Is it as simple as copy an paste or does it need some blockifs in for receipt pages etc?

    #2
    I'd change
    Code:
    '.google-analytics.com/ga.js'
    to
    Code:
    '.google-analytics.com/ga' + '.' + 'js'
    As Actinic has a habit of adding acatalog/ to file names it detects when building the home page (which is outside the acatalog directory).
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      http://community.actinic.com/showthread.php?p=313720
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


        #4
        If you follow Jonathan's link you'll still need my post #2 above.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Here it is with Norman's correction:
          You do get a javascript error if you use the Analytics number variable rather than entering the number itself
          A JavaScript errotr has been found on the page ('Expected']").
          I guess this is one of those Actinic errors one ignores and doesn't let the client see!
          Code:
          <script type="text/javascript">
          
            var _gaq = _gaq || [];
            _gaq.push(['_setAccount', '<actinic:variable name="GoogleAnalyticsNumber" />']);
            _gaq.push(['_trackPageview','<actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22">/receipt.html</actinic:block>']);
          
            (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>
          Jonathan Chappell
          Website Designer
          SellerDeck Website Designer
          Actinic to SellerDeck upgrades
          Graphicz Limited - www.graphicz.co.uk

          Comment


            #6
            Analytics

            Thanks for the help I also added the checkout process path.
            http://www.novadetox.co.uk

            Comment


              #7
              Can you show us how the code looks with that?
              Thanks!
              Jonathan Chappell
              Website Designer
              SellerDeck Website Designer
              Actinic to SellerDeck upgrades
              Graphicz Limited - www.graphicz.co.uk

              Comment


                #8
                Try this not sure if it works yet

                <actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleAnalyticsEnabled%22%20%2f%3e%20%3d%3d%20true" >
                <script type="text/javascript">

                var _gaq = _gaq || [];
                _gaq.push(['_setAccount', 'YOUR TRACKING NUMBER']);
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%200%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%201%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%202%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%203%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Receipt%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27PSP%20Bounce%20Page%27" > _gaq.push(['_trackPageview']);</actinic:block>
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" > _gaq.push(['_trackPageview', '/Order00.html']);</actinic:block>
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%201%22" > _gaq.push(['_trackPageview', '/Order01.html']);</actinic:block>
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%202%22" > _gaq.push(['_trackPageview', '/Order02.html']);</actinic:block>
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22PSP%20Bounce%20Page%22" > _gaq.push(['_trackPageview', '/PSPBounce.html']);</actinic:block>
                <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22"> _gaq.push(['_trackPageview', '/receipt.html']);</actinic:block>

                (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>
                </actinic:block>
                http://www.novadetox.co.uk

                Comment


                  #9
                  THis works but dosent track order details , price ect, just Recipt page views

                  <actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleAnalyticsEnabled%22%20%2f%3e%20%3d%3d%20true" >
                  <script type="text/javascript">

                  var _gaq = _gaq || [];
                  _gaq.push(['_setAccount', 'YOUR ACCOUNT NUMBER']);
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%200%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%201%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%202%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%203%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Receipt%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27PSP%20Bounce%20Page%27" > _gaq.push(['_trackPageview']);</actinic:block>
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" > _gaq.push(['_trackPageview', '/Order00.html']);</actinic:block>
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%201%22" > _gaq.push(['_trackPageview', '/Order01.html']);</actinic:block>
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%202%22" > _gaq.push(['_trackPageview', '/Order02.html']);</actinic:block>
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22PSP%20Bounce%20Page%22" > _gaq.push(['_trackPageview', '/PSPBounce.html']);</actinic:block>
                  <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22"> _gaq.push(['_trackPageview', '/receipt.html']);</actinic:block>

                  (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>
                  </actinic:block>
                  http://www.novadetox.co.uk

                  Comment


                    #10
                    Google New Tracking Code

                    Originally posted by globalee View Post
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsGoogleAnalyticsEnabled%22%20%2f%3e%20%3d%3d%20true" >
                    <script type="text/javascript">

                    var _gaq = _gaq || [];
                    _gaq.push(['_setAccount', 'YOUR ACCOUNT NUMBER']);
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%200%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%201%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%202%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Checkout%20Page%203%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27Receipt%27%20AND%20%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%21%3d%20%27PSP%20Bounce%20Page%27" > _gaq.push(['_trackPageview']);</actinic:block>
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%200%22" > _gaq.push(['_trackPageview', '/Order00.html']);</actinic:block>
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%201%22" > _gaq.push(['_trackPageview', '/Order01.html']);</actinic:block>
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Checkout%20Page%202%22" > _gaq.push(['_trackPageview', '/Order02.html']);</actinic:block>
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22PSP%20Bounce%20Page%22" > _gaq.push(['_trackPageview', '/PSPBounce.html']);</actinic:block>
                    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Receipt%22"> _gaq.push(['_trackPageview', '/receipt.html']);</actinic:block>

                    (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>
                    </actinic:block>
                    You need to alter the recipt page but I dont have a clue how to do that?? an ideas??
                    http://www.novadetox.co.uk

                    Comment


                      #11
                      You can find the default main receipt layouts at Design menu > Library > Layouts > Web Page Inner Layout > Receipt Page Bulk, also Web Page Outer Layout > Receipt Page Layout.
                      Peblaco

                      Comment


                        #12
                        Originally posted by peblaco View Post
                        You can find the default main receipt layouts at Design menu > Library > Layouts > Web Page Inner Layout > Receipt Page Bulk, also Web Page Outer Layout > Receipt Page Layout.
                        I got it working to track recipt views however i cant figure this out, its on the recipt page two layouts...

                        <actinic:variable name="GoogleAnalyticsMarkup" value="Google Analytics Variable Setup" />

                        <actinic:variable name="GoogleAnalyticsMarkup" value="Google Analytics Order Transmission" />
                        http://www.novadetox.co.uk

                        Comment


                          #13
                          Regarding Norman's fix above, if you view source on http://www.graphicz.eu.com/site1/ the analytics code displays as
                          Code:
                           '.google-analytics.com/ga' + '.' + 'js'
                          rather than
                          Code:
                          '.google-analytics.com/ga.js'
                          My client's SEO guy is unhapy about this. Can he be reassured that the code works OK like this?
                          Thank you.
                          Jonathan Chappell
                          Website Designer
                          SellerDeck Website Designer
                          Actinic to SellerDeck upgrades
                          Graphicz Limited - www.graphicz.co.uk

                          Comment


                            #14
                            The two forms should work exactly the same.

                            Comment


                              #15
                              Originally posted by globalee View Post
                              I got it working to track recipt views however i cant figure this out, its on the recipt page two layouts...

                              <actinic:variable name="GoogleAnalyticsMarkup" value="Google Analytics Variable Setup" />

                              <actinic:variable name="GoogleAnalyticsMarkup" value="Google Analytics Order Transmission" />
                              If you are using the same layout across all pages then 'Google Analytics Variable Setup' needs to go before the INNERLAYOUT and 'Google Analytics Order Transmission' needs to go after the INNERLAYOUT.

                              Essentially the variables that will contain the ecommerce data need to be defined before they can be set and transmitted.

                              Comment

                              Working...
                              X