Custom Event Listeners for GTM

(UPDATE 1 Oct 2014 Due to a change in how macros work in Debug Mode, the {{generic event handler}} macro no longer works when testing in Debug Mode. That means that you’ll have to test your custom listener in a live container (I know, ouch!). If you want to test in Debug Mode, you’ll have to skip using the {{generic event handler}} as a macro, and instead copy the inner function into the Custom HTML Tag, give the function a name, and use that as the callback in addEventListener or attachEvent. Read More…

GTM Listener Firing Order Test

Because I was bored, I did a quick test to sort out the firing order of competing GTM listeners. If you’ve done your homework (i.e. read my article on GTM listeners), you’ll remember that GTM listeners are set up on the document node of the document object model (DOM). I wanted to test what the firing order is if you have multiple competing listeners on the same page. I tested with the following listeners (make sure you read up on auto-event tracking if you are completely baffled at this point): Read More…

Google Tag Manager: The History Listener

There’s a new listener in town! It’s a few days now since the Google Tag Manager team unleashed the History Listener, and the time has come for me to tell you what this baby can do. The History Listener is designed to be used on websites where content is loaded dynamically. Typically, these websites make heavy use of AJAX (Asynchronous JavaScript and XML), which is designed for loading content in the background and serving it dynamically without having to reload the page. Read More…

Why Don't My GTM Listeners Work?

Ever so often I come across a Google Tag Manager setup where GTM’s own auto-event listeners don’t perform the task they were supposed to. Listener problems seem to be a hot topic in Google+ and the Product Forums as well. There may be many reasons why your listeners don’t work, but a very common trend is that you have conflicting JavaScript libraries or scripts running on your page. Let’s explore how listeners work before tackling the problem. Read More…

Auto-Event Tracking in Google Tag Manager

There is a new version of this post for GTM V2 here. The Google Analytics Summit came and went, and thanks to the Live Stream, everyone could participate. We were treated to a rapid-fire selection of Google Analytics’ new features, and this post sheds light on one of these in particular: automated event tracking in Google Tag Manager. Auto-event tracking introduces a nice feature, which does what tag managers ought to do: it provides functionality without HTML template editing. Read More…