Google has done one amazing thing with Google Tag Manager. They’ve managed to get implementation while selling the wrong product.
What they sell is an easy way for non-programmers to add tags to a site. Google Tag Manager isn’t easy and it requires some programming knowledge. If this is the reason that you signed up, you’ll be disappointed.
{{Obligatory Morpheus Image Removed}}
But what if I told you it could measure form submissions without needing to do much to the form itself? What about measuring clicks even to non-linked resources? What about determining engagement on a page by seeing how long a user stays?
The key is “listener events”, and it’s one of the most powerful elements of tag manager. Even so, it’s not what they’re selling, and in the news business we’d call that “burying the lede”
Traditionally the role of analytics has been to have data pushed to it by some external force. A page load, a java script event, or something else. The role of the site has been to tell analytics what it needs to know.
Google Tag Manager can reverse that role somewhat. These events are active “scans” for events that then can cascade to fire other events. It can open up entirely new ways of thinking about user measurement.
Click Listeners
The most basic is a click listener, but even it is a bit complicated to use.
Here’s the basic form of the way it’s meant to work. It’s a built in tag type. If you add this tag with the built in rule of all pages, it will send an event to GTM every single time a user clicks their mouse, regardless of where or what they are doing on the page. This includes even elements that have no action, such as an unlinked image.
The power comes in from reading the event that the click listener fires. This requires a second tag which is fired based upon the event of the click. The rule that makes this happen is simple: {{event}} equals gtm.click. When a tag fires based upon that rule, it can “read” a lot of the elements that were at the location of the click. These can include things like the id or class of the element. These are the macros of GTM. While it’s easy to get overwhelmed recording every click that happens, running something like this for a short time can show items that users expect to click on and improve user experience.
As simple as possible:
Click Listener tag -> Click event -> Rule looking for Click event -> Gather data from macros.
Making it more useful
Adding a second element to the click rule can start to limit the data that’s passed. For example, if we modify the rule to add an “element id” of interest, we can then fire a tag only when both conditions are met. This can use regular expression matching to extend into multiple elements of a pattern.
This could tell us every time some one tries to click on an “invalid” element we’ve “greyed out” or when people click on a reload button for capcha because they can’t read the first one.
It can pass data easily on forward and back buttons of an ajax slideshow.
In short it can open up measurement that used to take manual tagging of every element of interest.
It’s not easy, but it’s why GTM is powerful. Please add comments of interesting use cases or questions about click listeners.