Google Tag Manager (GTM) has become an incredibly powerful tool in eCommerce when it comes to tracking user behavior, gathering analytics, tracking affiliate activity, and user testing. Over the years I’ve watched the platform and technology grow beyond the original purpose of tag management. As a result, I’ve updated our approach to using it to make our work more efficient and effective. Below are a few tips to help you make sure you’re getting the most out of Google Tag Manager for your Magento eCommerce site.
If you’re using Magento Open Source, you will need a module to provide you with the dataLayer, but if you’re using the more advanced Adobe Commerce, Adobe has already provided a baked-in solution. Simply look under the Google settings in the admin, add your container ID, and you’re set. Assuming you haven’t done any major customization to your templates, Magento will now be providing dataLayer information for all your primary events. Pretty cool.
- Impressions (category pages and related product sliders)
- Product Detail (aka Product Pages)
- Adding and removing items from the cart
- Checkout events
- Transactions (order success)
- Promo Views (for promotional content like banners)
Are You The One?
I still see many clients using different GTM containers to manage different environments, like a development environment versus production. But I found the process of exporting and importing tag information between different accounts, and having to review and adjust any tags that overlapped or were overridden - well, cumbersome. Even the built-in environments seem a bit clunky to me. As a result, requiring human intervention as part of the process inevitably leads to errors. Conversely, by setting up all of your environments using the same container will not only simplify your management, but reduce some risk while you’re at it.
Ok, ok, get on with it already... It’s pretty simple really. Look under the Built-In Variables section and make sure you have ‘Page Hostname’ checked. With that enabled you will now see the host name coming through on events (e.g. staging.domain.com, www.mysite.com, etc.) and more importantly, use this data to set conditions. We can now create a trigger that may only fire on our staging environment, and configure a custom variable to use a lookup table so we provide different analytics IDs based on your hostname. On top of that, deployment doesn’t require merging containers or switching environments; which would result in twice the testing cost. Once your tags have been confirmed in Preview mode, it’s as easy as updating a trigger and publishing the changes to your site.
Less is More
When my family goes on vacation, it doesn’t matter if we’re leaving for just one night - sometimes my family needs EIGHT bags worth of stuff. It’s madness, and really causes me more stress than it should. So, my advice? Be mindful not to overpack for an overnight trip and when you’re reviewing your tag plan: minimize your tags. How many tags are too many? I don’t know, and I haven’t seen any conclusive performance testing to give any better advice other than the following: being nice to people, use your good common sense, and follow best practices:
- Pause or remove any tags not relevant to current tracking or testing
- Remove tags and triggers not being used
- Remove any custom variables not being used
For the “remove tags and custom variables”, I recommend that you should audit all of your Google Tag Manager entries once a quarter to make sure obsolete tags and variables are no longer being used.
Keep It Tight
Lastly, tag Management isn’t a “set it and forget it” situation - this isn’t the Honda Civic you drove for four years of college without ever once changing the oil - it’s important to review your tags and update accordingly as technology and your business needs grow. But you also don’t need to review your implementation every single day or week.
The platform is growing and more tagging is coming into play as we find new ways to offer personalized experiences to our customers, which is exciting but requires regular maintenance.
Google Tag Manager is also an excellent way to manage all of your 3rd party scripts for affiliate tracking, live chat, digital marketing, or advertising and social media tracking. Set up your ids as variables just like we set up our ecommerce tagging and you’ll keep the data clean. The added bonus: no need for code deployments or providing more admin access.