Announcement

Collapse
No announcement yet.

Upgraded to GA universal analytics code and ecommerce tracking stopped

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

    Upgraded to GA universal analytics code and ecommerce tracking stopped

    I have upgraded my tracking for Google Analytics to Universal Analytics as suggested by GA team. I made the following changes to the GA module by Miva Merchant.

    Replaced the old GA code in the GA code tab to and moved the token to the <head> tag.

    Code:
    <script>
      (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
      m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
      })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
    
      ga('create', 'xx-xxxxxxxx', 'auto');
      ga('send', 'pageview');
    
    </script>
    also added the new universal GA code for ecommerce in the GA ecommerce tab. This part of the code is still in global footer.

    Code:
    <script type="text/javascript">
      ga('require', 'ecommerce', 'ecommerce.js');
      ga('ecommerce:addTranscation', {
      '&mvt:ga_transaction:order_id;',    // transaction ID - required
      '&mvt:ga_transaction:store_name;',    // affiliation or store name
      '&mvt:ga_transaction:order_total;',    // total - required
      '&mvt:ga_transaction:total_tax;',    // tax
      '&mvt:ga_transaction:total_ship;',    // shipping
      '&mvt:ga_transaction:ship_city;',    // city
      '&mvt:ga_transaction:ship_state;',    // state or province
      '&mvt:ga_transaction:ship_cntry;'    // country
      });
    <mvt:foreach iterator="item" array="ga_transaction:orderitems">
     ga('ecommerce:addItem', {
     '&mvt:item:order_id;',            // transaction ID - required
     '&mvt:item:code;',            // SKU/code - required
     '&mvt:item:name;',            // product name
     '&mvt:item:cancat_code;',        // category or variation
     '&mvt:item:price;',            // unit price - required
     '&mvt:item:quantity;'            // quantity - required 
     });
    </mvt:foreach>
    ga('ecommerce:send'); //submits transaction to the Analytics servers
    </script>
    I am getting orders but they are not getting tracked by GA.

    What am I missing or doing wrong.

    Thanks
    Keyboard Not Found..... Press F1 to continue

    #2
    Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

    Reading above, it appears you've copied the new Universal tracking code, but the code you've output for the ecommerce tracking isn't what the module outputs. Our GA tracking code on the INVC page looks like this:

    Code:
    ga( 'require', 'ec' );
    
        <mvt:foreach iterator="ga_orderitem" array="ga_tracking:orderitems">
        ga( 'ec:addProduct', {
            'id'        : '<mvt:item name="ga_jsencode" param="ga_orderitem:code_unencoded" />',
            'name'        : '<mvt:item name="ga_jsencode" param="ga_orderitem:name_unencoded" />',
            'price'        : '<mvt:item name="ga_jsencode" param="ga_orderitem:price" />',
            'variant'    : '<mvt:item name="ga_jsencode" param="ga_orderitem:variant_label_unencoded" />',
            'quantity'     : '<mvt:eval expr="l.settings:ga_orderitem:quantity" />'
        } );
        </mvt:foreach>
    
    
        ga( 'ec:setAction', 'purchase', {
            'id'             : '<mvt:eval expr="int( l.settings:ga_orderitem:order_id )" />',
            'revenue'         : '<mvt:item name="ga_jsencode" param="ga_tracking:order_total" />',
            'affiliation'    : '<mvt:item name="ga_jsencode" param="store:name" />',
            'tax'            : '<mvt:item name="ga_jsencode" param="ga_tracking:total_tax" />',
            'shipping'        : '<mvt:item name="ga_jsencode" param="ga_tracking:total_ship" />'
        } );
    </mvt:if>
    ga( 'send', 'pageview' );
    Also, if you do switch to Enhanced Ecommerce, remember there is a setting within Google Analytic's admin that needs to be enabled to access the Enhanced Ecommerce features.

    Regards
    Last edited by pbrynie; 02-10-15, 10:20 AM. Reason: code example
    Preston Brynie
    Software Developer
    Miva Merchant
    http://www.mivamerchant.com/

    Comment


      #3
      Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

      Thanks for replying so am I not supposed to use the existing GA module by Miva Merchant and just use the code given by Google directly.
      Keyboard Not Found..... Press F1 to continue

      Comment


        #4
        Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

        Thanks for the example appreciate it. one more question can this be still in Global Footer or should it be moved to Head tag.
        Keyboard Not Found..... Press F1 to continue

        Comment


          #5
          Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

          There are two ecommerce plug-ins provided by Google. One is simple ecommerce tracking 'ecommerce' and is used by calling...

          ga( 'require', 'ecommerce' );

          and the other is called 'ec' which is Enhanced Ecommerce and is used by calling...

          ga( 'require', 'ec' );

          In order to use the 'ecommerce' plug-in with the snippet you have there, you would need to put the module in Classic (ga.js) mode and then update your tracking code with the new snippets from Google to your Tracking Code and Ecommerce Tracking tab.
          Preston Brynie
          Software Developer
          Miva Merchant
          http://www.mivamerchant.com/

          Comment


            #6
            Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

            You can put the tracking code and ecommerce tracking anywhere on the page.
            Preston Brynie
            Software Developer
            Miva Merchant
            http://www.mivamerchant.com/

            Comment


              #7
              Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

              Thanks again I was following the code you first posted and I got this error saying "ga_jsencode" not in the list of valid items.

              Do I have to add that item to Miva if so where can I find this item. I searched under items and it was not there.
              Keyboard Not Found..... Press F1 to continue

              Comment


                #8
                Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                Upgrading to MM9 or simply installing the module in MM9 should have created a ga_jsencode item, but you would need to create one from the mvga.mvc module if you don't see it and assign it to all pages.

                It appears you are trying to use the universal.js API, so the easiest way to achieve this would be to go to the Google Analytics Settings tab and put the module in Universal with Enhanced Ecommerce mode. Then go to the Google Analytics Tracking Code Tab and make sure the module is in Point + Click mode and click Update. This will generate the default tracking and transaction tracking template for the universal.js.
                Preston Brynie
                Software Developer
                Miva Merchant
                http://www.mivamerchant.com/

                Comment


                  #9
                  Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                  Ok I have did this, One question do I need to remove the existing <mvt:item name="ga_transaction" /> from the INVC page as I think this is not needed now

                  Thanks
                  Keyboard Not Found..... Press F1 to continue

                  Comment


                    #10
                    Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                    In the new Universal and Universal with Enhanced Ecommerce modes the "ga_transaction" item is not used.

                    Regards,
                    Preston Brynie
                    Software Developer
                    Miva Merchant
                    http://www.mivamerchant.com/

                    Comment


                      #11
                      Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                      As you can see there were some recent changes made to the stock Google Analytics options that make this much more difficult than it needs to be. I know Miva is working on it for the next release, however in the meantime I can offer our Google Analytics integration services as stated in this other thread if your interested: http://extranet.miva.com/forums/show...662#post428662

                      Comment


                        #12
                        Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                        When we upgraded to Miva 9, we ignored the notice that KSE module was discontinued, and all seems to be working fine.

                        Google is picking up every item sold as well as the checkout funnel. Am I missing something here?
                        Jim Sisk
                        Uncommon Treasures

                        Comment


                          #13
                          Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                          The module for the most part continues to work, however it is on borrowed time. Not being updated since 2013, this module relies on outdated tracking code and processes which could fail at any time if Google decides to drop support. (I think it is past due at this point) This is why the M9 message was more of an informational type vs. critical. We have no intention of bringing this module back to life unless there were long term or perminant voids with Miva's stock capabilities.
                          Last edited by Dan - Glendale Designs; 02-17-15, 07:47 AM.

                          Comment


                            #14
                            Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                            Thanks Dan. Kinda what we figured. Since we need to completely rebuild our site to get off of MMUI, we are trying to minimize the labor spent on the current setup.
                            Jim Sisk
                            Uncommon Treasures

                            Comment


                              #15
                              Re: Upgraded to GA universal analytics code and ecommerce tracking stopped

                              I am having problems with this as well. I have been trying to modify the miva settings and testing it each day, but it just isn't tracking the ecommerce data at all. I have had to resort back to 'classic' to get things to work on several stores. Reverting it to 'classic' at least tracks the ecommerce data again.

                              I have 'enhanced analytics' enabled in the analytic's accounts itself.

                              I did what Preston suggested with selecting 'enhanced ecommerce' mode in miva and putting the GA Tracking code tab in Point and click mode and clicking update.

                              But I am still not getting the ecommerce data.

                              Are there other steps to getting the ecommerce data to track properly? What other settings need to be checked? I have at least a half dozen stores that I need to get this working right in so any help would be appreciated.

                              Comment

                              Working...
                              X