Announcement

Collapse
No announcement yet.

Google Analytics

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

    Google Analytics

    we are having trouble getting Analytics to work properly in MM9 with a ready theme.

    All the docs I have seen say that once you enable anayltics (user interface / analytics...) then the code "is placed on the pages"

    The fact is - thats not correct, as no code appears anywhere unless I manually put it in the header - which does not seem 100% correct, and certainly not automated.

    Assuming that nothing "automatically" happens, how do I properly enable the Google Analytics?
    ie - what item tags go where?


    MM( store, Suviant theme - upgraded over the years...
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    #2
    Re: Google Analytics

    Hi William,

    Once you activate Google Analytics in Utilities, all the items should be assigned to the pages and this tag should be added to the bottom of the Global Footer:
    Code:
    <mvt:item name="ga_tracking" />
    .

    Additionally, this tag should be added to the INVC page just below the Global Footer item:
    Code:
    <mvt:item name="ga_transaction" />
    .
    Matt Zimmermann

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      Re: Google Analytics

      Honestly,
      Its not that easy..

      Not sure what the issues are at this point, but the conversion itself does not record.
      We are able to see traffic now, but thats as far as we get....

      There really should be a step by step available.
      I had to dig to find that maybe I need to go to point and click mode to generate the proper code - but still, that code is not 100% correct it seems.

      And when where to use the "other" ga item as mentioned in one post I found...
      Do I us ga_jsencode ??
      When? where? how? why?
      - but it is called from the analytics template so maybe I don't need it....
      William Gilligan - Orange Marmalade, Inc.
      www.OrangeMarmaladeinc.com

      Comment


        #4
        Re: Google Analytics

        In the current implementation of the GA module there are two ways to get ecommerce tracking. Classic mode (which is the legacy google analytics code) or "Universal Enhanced With Ecommerce". Right now if you have the mode set to "Universal" then the ecommerce tracking code will not be output (You would need to manually add it).

        This is fixed in 9.3. We added an option to turn on ecommerce tracking if you are not using the Enhanced Tracking mode.

        The other items you see ga_jsencode are helper modules that do some javascript encoding. They provide items used within the tracking code itself to provide encoding:

        Code:
        ga('create', '<mvt:item name="ga_jsencode" param="ga_tracking:google_id_unencoded" />', 'auto');


        Here is the standard Universial code with ecommerce tracking (This is the same code we output in 9.0003):

        Code:
        <mvt:miva compresswhitespace="off" />
        <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', '<mvt:item name="ga_jsencode" param="ga_tracking:google_id_unencoded" />', 'auto');
        <mvt:if expr="l.settings:page:code EQ 'INVC'">
        	ga('require', 'ecommerce');
        
        
        	ga( 'ecommerce:addTransaction', {
        		'id'			: '<mvt:eval expr="int( l.settings:ga_tracking: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:foreach iterator="ga_orderitem" array="ga_tracking:orderitems">
        	ga( 'ecommerce:addItem', {
        		'id'		: '<mvt:eval expr="int( l.settings:ga_tracking:order_id )" />',
        		'name'		: '<mvt:item name="ga_jsencode" param="ga_orderitem:name_unencoded" />',
        		'price'		: '<mvt:item name="ga_jsencode" param="ga_orderitem:price" />',
        		'sku'		: '<mvt:item name="ga_jsencode" param="ga_orderitem:code_unencoded" />',
        		'category'	: '<mvt:item name="ga_jsencode" param="ga_orderitem:cancat_code_unencoded" />',
        		'quantity' 	: '<mvt:eval expr="l.settings:ga_orderitem:quantity" />'
        	} );
        	</mvt:foreach>
        
        
        	ga( 'ecommerce:send' );
        </mvt:if>
        
        
        ga( 'send', 'pageview', { 'page':'/<mvt:item name="ga_jsencode" param="ga_tracking:url_override_unencoded" />' } );
        
        
        </script>
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment

        Working...
        X