David Vallejo - Web Analyst

Tips for working with Custom HTML & Custom JavaScript tags in Google Tag Manager

This time I'm writting down some tips for when you guys are playing around with the custom HTML tags or custom JavaScript variables not only for Google Tag Manager, but for any other TMS or website. Most times due the projects deadlines or maybe just lazyness, the code we use (I include myself here), is not fail proof, and we need to think that we may broke some page functionality or even some page load. So using customHTML/custom JavaScript is a…


Getting super clean content reports in Google Analytics using GTM

In Google Analytics the urls are case sensitive, therefore in our content reports /index.html will be different to /Index.html, and querystring values will make Google Analytics to think that even if it's the same page it will recorded as a new one, /index.html?cache=off and /index.html?cache=on will be recorded as 2 different pageviews for example. The first problem its easily fixable with a lowercase filter within the views, but…


Tricks to deal with customized Google Analytics and Google Tag Manager integrations

In the past years, I worked on implementing Google Analytlics and Google Tag Manager in a lot of differences scenearios and almost any kind of integrations. So I'm gonna show you some code snippets that may help you integrating Google Tag Manager and Google Analytics into your libraries in the best way possible. Checking is Universal Analytics is available Most integrations I've seen does check for the ga object within the DOM before trying…


Debugging and monitoring GTM Variables for errors

Google Tag Manager does not throw any error when the code in a variable fails. This is not bad per se as it would save us from having our sites failing if something is not coded as it should, but it will blind us agains some minor errors that may not be noticiables, for example if our Enhanced Ecommerce is failing for a certain product, or from some specific browser. Thanksfully we can use try{}catch(e){} to capture those errors :). And we could…


Tracking Optimizely redirect type experiments

In my previous post I've talked about how to manage to use the native Optimizely tracking when using Google Tag Manager . Now we're going further and we'll learn how to track the experiment that are based on redirects in the best way possible. So, firstly you'll need to enable the Optimizely and Google Analytics integration. Now here is the tricky part. If we're sending users to an experiment page that it's based on a redirect we'll be likely…


Enabling Optimizely native Google Analytics Integration within Google Tag Manager

As you may already know, Optimizely has an in-built Google Analytics integration, which will allow us to track the experiments and variations being showed to a client using custom dimensions. For enabling them, you'll need to put the following lines after the create command and the pageview one: window.optimizely = window.optimizely || []; window.optimizely.push("activateUniversalAnalytics"); This is a bit tricky when using Google Tag Manager…


Closing "Inside GTM" Blog, all content now hosted here!

Two years ago I started "Inside GTM", a blog focused on Google Tag Manager and other TMS tools along with @nikalytics, but we haven't published anything since February, so we've agreed to close it :( . After publishing the notice in Twitter, some people asked what was going to happen with the content already hosted there, so I'm moving all the content I wrote there in my own blog, this is in this blog. Time to close the gtm blog ...…


#Tip - Finding Legacy GA code after migrating to Universal Analytics

You may have already migrated your Google Analytics Implementation to Universal Analytics. It may happen that you still have some legacy ga snippet lying around in some pages without having noticed it, for example in some landing pages that are not belong the default CMS system/templates. But we can easily check this out just looking at Google Analytics data. It's as easy as crossing your pageview/event reports with the "Data Source" dimension. This…


Finding pages missing Google Tag Manager snippet within Google Tag Manager

This time, we'll be using Google Tag Manager itself, to find pages in our site that may be missing Google Tag Manager. Ok, it may sound strange, but was not able to find any other way to say it . Basically we're going to use a custom html tag, to detect is the previous page had loaded Google Tag Manager code. To achive this we'll be using a single Custom HTML tag ,a cookie and the onbeforeunload event. The following flow chart will show…


Tracking the Hover Intent with Google Tag Manager

At the moment, Google Tag Manager listeners are limited to Form Submits, Link Clicks and Clicks (for any DOM element). We are going to write a custom listener for hover intents by users. This means that we're not only to do something when the user pass the mouse pointer over an element, but instead we're waiting a certain time with the mouse over the element before submitting the action to GTM. For this we're going to use the mouseenter and…