Announcement

Collapse
No announcement yet.

Google Tag Manager

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

    Google Tag Manager

    Google recently announced a new product Tag Manager. I wasn't certain if I needed a tag manager but after installing it, I am glad I did.

    Tag management isn't necessary for all users. If your existing tags are working and you rarely change them then Tag Manager is probably not for you. If you have several users, departments or third party agencies you probably need a tag management system. I fell in between. I change tags occasionally for remarketing lists, analytic events, and custom variables.

    It takes time to update and test tags since I also use Merchant Optimizer and I need to deploy the new tags and conditionals, then I need to test them. So I thought for ease of maintenance I would give Google Tag Manager a try. ( I also try to follow the programmers principals of LoD, open/closed, and SoC.)

    There are many blogs, tutorials and videos on how to set up and use Tag Manager so I won't get into that. You will have to configure your tags in Tag Manager. I'll just share the Miva integration.

    1. I created a new page tagman. I pasted the js code snippet that Google Tag Manager provides and saved the template.

    2. On all pages that require tags, immediately below the opening <body> tag I rendered the tagman page :

    Code:
    // head
    <body>
    <mvt:item name="ry_toolbelt" param="screen|tagman" />
    
    // rest of page
    3. I removed all GA tags in the header and Adwords remarketing tags in my footer

    4. I created a dataLayer in the Global Head:

    Code:
    <mvt:comment>Begin Google Tag Manager</mvt:comment>
    
    <mvt:comment>example of creating a macro used for funnelization _trackPageview </mvt:comment>
    
    <mvt:if expr="(g.screen CIN 'BASK|OCST|OSEL|OPAY')">
    <script type="text/javascript">
    var dataLayer =  dataLayer || [];
    dataLayer.push({'screen': '&mvt:global:screen;'});
    </script>
    </mvt:if>
    
    <mvt:comment>example of creating a custom variable used for advanced segments</mvt:comment>
    
    <mvt:if expr="g.customer">
    <script type="text/javascript">
    var dataLayer =  dataLayer || [];
    dataLayer.push({'login': '&mvt:global:customer:id;'});
    </script>
    </mvt:if>
    
    <mvt:comment>example of transaction dataLayer</mvt:comment>
    
    <mvt:if expr="(g.Screen EQ 'INVC')">
    <script type="text/javascript">
    var dataLayer =  dataLayer || [];
    
    <mvt:comment>populate macro for funnelization _trackPageview </mvt:comment>
    dataLayer.push({'screen': 'INVC'});
    
    <mvt:comment>populate data to _addTrans</mvt:comment>
    dataLayer.push({
        'transactionId': '&mvt:order:id;',
        'transactionAffiliation': '',
        'transactionTotal': '&mvt:order:total;',
        <mvt:if expr="l.settings:order:charges"><mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'SHIPPING'">
        <mvt:item name="ry_toolbelt" param="assign|g.shipping_charge_total|g.shipping_charge_total + l.all_settings:charge:amount" />
        </mvt:if></mvt:foreach></mvt:if>
        'transactionShipping': '&mvt:global:shipping_charge_total;',
        <mvt:if expr="l.settings:order:charges"><mvt:foreach iterator="charge" array="order:charges"><mvt:if expr="l.settings:charge:type EQ 'TAX'">
        <mvt:item name="ry_toolbelt" param="assign|g.tax_charge_total|g.tax_charge_total + l.all_settings:charge:amount" />
        </mvt:if></mvt:foreach></mvt:if>
        'transactionTax': '&mvt:global:tax_charge_total;',
        'transactionCity': '&mvte:order:ship_city;',
        'transactionState': '&mvte:order:ship_state;',
        'transactionCountry': '&mvte:order:ship_country;',
        'event': 'addTrans'
    });
    
    <mvt:comment>populate data to _addItem</mvt:comment>
    
    <mvt:foreach iterator="item" array="order:items"> 
       
    dataLayer.push({
        'id': '&mvt:order:id;',
        'name': '&mvte:item:name;',
        'sku': '&mvte:item:code;',
        <mvt:item name="ry_toolbelt" param="Product_Categories|g.length|l.all_settings:item:product:code" />
        'category': '&mvte:product_categories[1]:code;',
        'price': '&mvt:item:price;',
        'quantity': '&mvt:item:quantity;',
        'event': 'addItem'
    }); 
    
    <mvt:comment>populate data to _addItem attributes</mvt:comment>
    <mvt:comment>the name and sku variables can be modified for your use</mvt:comment> 
    
    <mvt:foreach iterator="option" array="item:options">  
      
    dataLayer.push({
        'id': '&mvt:order:id;',
        'name': '&mvte:option:attr_code;',
        <mvt:if expr="l.settings:option:option_id">
        'sku': '&mvte:option:prompt;',
        <mvt:elseif expr="NOT ISNULL l.settings:option:data">
        'sku': '&mvte:option:data;',
        <mvt:elseif expr="NOT ISNULL l.settings:option:data_logn">
        'sku': '&mvte:option:data_logn;',
        <mvt:else>
        'sku': '&mvte:option:opt_code;',
        </mvt:if>
        'category': '&mvte:product_categories[1]:code;',
        'price': '&mvt:option:price;',
        'quantity': '1',
        'event': 'addItem'
    }); 
     
    </mvt:foreach>
    
    </mvt:foreach>
    </script>
    </mvt:if>
    <mvt:comment>End Google Tag Manager</mvt:comment>
    Here is an example of dataLayer for event tracking:

    Code:
    <a href="#" onclick="dataLayer.push({'event': 'GAevent', 'eventCategory' : 'video', 'eventAction' : 'play', 'eventLabel' : 'video title goes here'});">Click to Watch Video</a>
    It's very easy to create tags in Tag Manager once you get use to it. Look for the more settings button when you are creating or editing a tag. I overlooked it the first few times. Macros can seem confusing but they're not. It is just a fancy way of creating a variable.

    Make sure you annotate your GA account to the tag management change.

    I no longer need the Adwords remarketing tags because I started using Google Analytics Remarketing lists. Check the 'Add Display Advertiser Support' button when creating a tag for GA Remarketing lists.

    P.S. Happy New Year!
    http://www.alphabetsigns.com/

    #2
    Re: Google Tag Manager

    Very helpful post! Even a couple of years later this is still the only Miva specific resource for setting up the GTM. Have you had any luck in setting up enhanced ecommerce? What about tracking addtocart and removefromcart?

    Comment


      #3
      Re: Google Tag Manager

      What about tracking addtocart and removefromcart?
      MM9's Google Analytics integration offers Enhanced Ecommerce as an option.

      Comment


        #4
        Re: Google Tag Manager

        Very interesting, but I'm not sure I fully understand the purposes of Tags in this case, could you please give me several examples how Tag Manager would be used by an online store owner? Is Tag Manager meant to replace Google Analytics or compliment?

        I visited the Google Tag Manager website, but I am understand if I understand the concept correctly.

        Google Tag Manager
        is a free tool that makes it easy for marketers to add and update website tags -- including conversion tracking, site analytics, remarketing, and more—with just a few clicks, and without needing to edit your website code. Take a quick look at how easy it is to set up an account and manage your tags.
        I dont understand why a store owner need more than one tag, and change them often. For example, once you install google tracking code, you never need to go back and change anything.

        Im missing something here...
        Thank you, Bill Davis

        Comment


          #5
          Re: Google Tag Manager

          We have tags for Google Analytics, Adwords, Adwords remarketing, Google Trusted Stores, Bing Ads, Bronto conversion tracking, Affiliate sales tracking, and a few more I can't recall. When they change, like Bing recently changed their tracking code, OR if you want to adjust your remarketing lists, it's easier if they are all centrally located in a tag manager.
          Last edited by gmanning; 04-19-15, 03:57 AM.
          Geoff Manning
          -------------------------
          Miva Sites: Oriental Furniture | Room Dividers

          Comment


            #6
            Re: Google Tag Manager

            Thanks, that clears things up for me. Can you please post a implementation steps and copy of the code (commented) you are using (replacing identifiable information with a descriptive generic value e.g.: [GOOGLEID:XX-XXXXX], etc...)?

            We hope to be launching our M9 store soon, and I would like to implement this.
            Thank you, Bill Davis

            Comment


              #7
              Re: Google Tag Manager

              I was thinking that Google Tag Manager was new to the game but I see this thread started back in 2012. My question is very similar - can / should Google Tag Manager replace the built in Google Analytics settings OR this to be used in addition to it?
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #8
                Re: Google Tag Manager

                We use it on a few sites. It works well and has gotten a lot better over the years (in terms of tags it supports). There is a bit of a learning curve to getting it setup, but for a site that has a lot of JS tags being loaded it is worth the effort to keep things organized.

                If you're going to use it, I would put as many tags in as possible including GA just to keep things organized and in one place.
                Brennan Heyde
                VP Product
                Miva, Inc.
                [email protected]
                https://www.miva.com

                Comment


                  #9
                  I'm having a hard time understanding one of the very first steps on these instructions. He says he built a page to hold the js given by GTM. He then calls it onto all the pages using this:

                  // head

                  <body>
                  <mvt:item name="ry_toolbelt" param="screen|tagman" />

                  // rest of page

                  What does the "name" and "param" refer to? I'm not sure what to put where. I have created a page called "tagman". Could someone possibly explain how the above code imports the other page?
                  Last edited by IndustrialOdorControl; 03-03-16, 11:50 AM.

                  Comment


                    #10
                    The name and param refer to a third party toolbelt module from PCI.

                    You no longer need the module and can use a native miva function:

                    Code:
                    <mvt:do name="l.result" file="g.Module_Feature_TUI_MGR" value="TemplateManager_Render_Page( 'tagman' )" />
                    This is kind of an old thread so you will most likely need to update the js code snippet in the tagman page.
                    http://www.alphabetsigns.com/

                    Comment

                    Working...
                    X