Data Collection, Inspiration

Event Tracking for Mouseover/Hover on Element for X Seconds

A client of mine recently asked me to track ‘mouse interaction’ with an iframe that they embed on several pages. By ‘mouse interaction’, the client basically meant that they would like to track whenever users hovered their mouse cursor over the iframe for a certain amount of time. I’ve previously posted that you can track any mouse or keyboard interactions with Google Analytics. As long as they occur within the browser.

Luckily, there’s a widely supported browser event called ‘mouseover‘. The mouseover event fires when a user moves the mouse cursor over a specified element – for instance, an iframe. But it can be used on any visible HTML element on the page. So, by combining this event with a timer, it’s possible to push a dataLayer event to Google Tag Manager. And then use that event to send an event hit Google Analytics.

In the end, we’ll end up tracking Google Analytics events whenever a user hovers his or hers mouse over our specified element. Continue reading

Data Collection

How to use the (UTM) Campaign URL Builder

The Campaign URL Builder for Google Analytics is a free tool. It lets you build URLs by appending certain parameters to your existing landing page URLs. In turn, this lets you track inbound traffic from marketing campaigns in Google Analytics on a detailed level. Ultimately, you’re better equipped to analyse the performance of campaigns. And you’re able to do so on a per marketing channel basis.

Let’s say you’re running a Winter 2016 Sale. You promote it on Facebook and in your email newsletter. By using the Campaign URL Builder, you’re able to track visits, behavior and conversions related to that campaign. And you’re able to examine it on marketing channel as well and see how the campaign is performing on Facebook vs. the newsletter. Continue reading

Data Collection, Data Quality

Track Real Time on Page for Bounces and Exits with GTM

The Time on Page metric is probably one of the most misunderstood metrics in Google Analytics. Google Analytics measures the time on page for each page, but can only do so by measuring the elapsed time between two interactions. The first interaction is the timestamp of the initial pageview, and the second interaction is usually the timestamp for the next pageview (or an event). So for sessions with just one pageview (i.e. bounces) there’s just one timestamp. In those cases, Google Analytics is unable to measure the time on page. As such, for the time spent on a page for bouncing sessions and on exit pages there’s simply no data. (there’s no ‘last’ timestamp on exit pages either). The real time on page is therefore likely higher than what your reports are telling you.

Continue reading

Data Collection, Data Quality

Which Ad Blockers are blocking Google Analytics?

Ad blocking software has gotten a lot of attention recently. Not because it’s new, but likely because it’s being used more widely. Studies put the ad block penetration at up to 37% or even higher – it depends on country and other factors. Ad blockers are intended to block those annoying (remarketing) ads that follow you around the net. But are ad blockers also affecting our ability to collect traffic data, e.g. by blocking Google Analytics?
Continue reading

Data Collection, Inspiration

Track Anything in Google Analytics with Event Listeners

There is one thing I hear a lot when I’m giving talks about Google Analytics: “I didn’t know Google Analytics could track that!”. Put another way, I just as often get a question like “Could you make Google Analytics track [insert anything here]?”. The short answer is always, “Yes, you can track that in Google Analytics”. Basically, you can track anything that goes on inside a browser. If it happens within a browser (a mouse click, a keyboard key click, a mouse movement, scrolling) you can track it. This means that we can make Analytics listen for and track anything that happens in the browser as long as it’s triggered by the user. Luckily, there’s a nifty thing called event listeners help us.

The thing is, that browsers have a lot of built-in DOM events. Events that are tied to the (HTML) document. And with javascript, it’s possible to listen for those events and trigger a self-defined function based on those events. And since Google Analytics hits (e.g. pageviews and events) are sent to Google Analytics using javascript functions, we can send information to Google Analytics based on any DOM event. In this post, I’ll take you through some interesting use cases for various DOM events. Continue reading