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 :
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:
Here is an example of dataLayer for event tracking:
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!
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
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>
Code:
<a href="#" onclick="dataLayer.push({'event': 'GAevent', 'eventCategory' : 'video', 'eventAction' : 'play', 'eventLabel' : 'video title goes here'});">Click to Watch Video</a>
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!
Comment