David Vallejo - Web Analyst

Tips for debugging your Google Tag Manager implementations

I'm going to share some of the tips and tricks I've learnt (and that I use on my daily basics work) in the almost past 3 years since Google Tag Manager was released. Tip #1 - Grabbing a dataLayer value from the console If we want to grab the current value in the Google Tag Manager's dataLayer, it offers a built-in get method for it. When GTM loads a global object is created named google_tag_manager, that has a key that is the current GTM Id…


Preventing duplicate transactions in Universal Analytics with Google Tag Manager

One of the most common headaches while implementing the ecommerce tracking on a site is trying to match the tracked transactions by the shop backend to Google Analytics. As most tracking solutions are JavaScript based, there's a small chance of losing some of them and there's nothing we can do without playing with the measurement protocol and some server-side tracking. Another problem that is usually present is having duplicated transactions. And…


Locating legacy hardcoded events and pageviews using Google Tag Manager

If you're migrating from classic Google Analytics (_gaq object) to Universal Analytics, or planning to migrate your old hardcoded events to use Google Tag Manager you may have run in the case that not all old tracked was really removed from the site by the client. And it's really hard to find it out. We'll learn today how to track this situation natively using just in-built Google Tag Manager features and allowing us to track all those…


Detecting and tracking page's printing intent with Google Tag Manager

I was looking for something new to track within the websites interactions, and I decided to give a try to track the user's intent to print our pages. So I'm going to show you my own approach for tracking this user action using Google Tag Manager. We'll need to create a new tag with the following code will allow us to track the user printing intent when he clicks on printing from the File Menu or when he uses the keys shortcut (Control-P on Windows)…


Tip: Maintaining Proper Session Attribution in GA when using OAuth providers with Google Tag Manager

If you using Facebook, Twitter, Github or any other service to autenticate your users, you may have noticed that they end showing up as referral traffic from the oauth service. User lands from CPC -> Logs in -> Respawns a new visit as referral We could think on adding those domains to the ignored referrals within our view configuration, but this will and hidding the real referal traffic from those networks. The screenshot above is an example…


Tip: Grabbing the visitor's first date from cookies using Google Tag Manager

With the new Universal Analytics cookies and everything being calculated server-side, it's more difficult to detect some attribution problems or verifying if they were already fixed. For example after fixing a self-referrals problem we can continue getting more of them in our reports if some users were previusly tagged in Google Analytics. One little trick we could use is to grab the cookie creation date from the "_ga" cookie, convert it to an understandable…


Track alert() pop ups automatically in Google Tag Manager

Did you ever faced a site that still used the old-fashined alert popups for example for showing a form validation messages? and you were wondering how to track that form alert popups without needing to change anything on the site (as it is likely going to be an old one). And yep,they still exist. Hopefully if we are already using Google Tag Manager (or we can tell the client to add some little piece of code to their pages) we could track…


Tips to track an ajax based website using GTM and Universal Analytics

I've been dealing with some Ajax based website tracking these past months (mostly AngularJS based ones), and I've learn a lot of stuff , mostly some important points about how Google Tag Manager does work. Usually tracking an Ajax based website is a PITA, since mostly we don't have page reloads as all the content is loaded asynchronously. So either you ask the developers to push you the content loaded info into the dataLayer or you play with the…


Pushing custom commands to Universal Analytics before Pageview tag execution

Since I wrote the post about how to send a local copy of Universal Analytics hits I've been looking for a way to get this working within Google Tag Manager. But there's no way to send anything between the tracker creating and the hit firing on GTM. Some time ago there was a discussion thread on Twitter commenting this problem: @calebwhitmore @SimoAhava @DanielJTruman @peter_oneill cHTML is small price to pay for avoiding polluting data with…


JWPlayer video tracking using Google Tag Manager

JWPlayer is one the most known video players (if not the most one) and today we're going to learn how to track it using GTM (Google Tag Manager). This time we're going to use an agnostic dataLayer pushes instead of the ones that we usually use for Google Analytics.  We'll be using one tag, one trigger and one variable, and in the next list we're resuming all the events that our code will be able to track: Video PlaysVideo PausesVideo CompletionsVideo…