Measuring Time On (Bounce) Page

For people measuring their website traffic with Google Analytics, there is nothing more frustrating than building a really popular web page that gets tons of visits, but GA shows Session Duration close to ZERO! The problem is that Google Analytics doesn’t measure the time on the last page of a visit, so even if they read your article for 5 minutes, if they don’t click on another page, their session is recorded as 0 seconds. Sigh….

engagement-reportSeveral people have suggested methods to measure the real time on page, and most of them have some combination of ‘did they scroll?’ or ‘did they read all the way to the bottom?’, and they record the time in seconds. After trying a few, I finally realized what I wanted was the Audience-Behavior-Engagement report.  A simple count of the number of sessions in a histogram, I realized there is a better way…a simpler way.

Instead of tracking the actual time on page and then fussing with data to build a pretty histogram report, I could capture the actual histogram groups themselves! The result lets me  easily build a report to visualize how long people are spending on my landing pages even if they bounce!


The magic is performed with a simple Javascript snippet, placed just before the </head> tag:

<script type="text/javascript">
function timer11(){ga('send', 'event', 'TimeOnPage', '1', '11-30 seconds', { 'nonInteraction': 1 });}
function timer31(){ga('send', 'event', 'TimeOnPage', '2', '31-60 seconds', { 'nonInteraction': 1 });}
function timer61(){ga('send', 'event', 'TimeOnPage', '3', '61-180 seconds', { 'nonInteraction': 1 });}
function timer181(){ga('send', 'event', 'TimeOnPage', '4', '181-600 seconds', { 'nonInteraction': 1 });}
function timer601(){ga('send', 'event', 'TimeOnPage', '5', '601-1800 seconds', { 'nonInteraction': 1 });}
function timer1801(){ga('send', 'event', 'TimeOnPage', '6', '1801+ seconds', { 'nonInteraction': 1 });}
ga('send', 'event', 'TimeOnPage', '0', '0-10 seconds', { 'nonInteraction': 1 });

time-on-page-event-labelsVery simply, it sets up a series of timers that trigger after a period of time, and when they do, they trigger a non-interaction event in Google Analytics.  The events use a Category of ‘TimeOnPage’, and an Action of 0 through 6 in order of the time spent on the page.

I populated the Event Labels with the actual group labels I wanted in my report, so I could use them in my reports.

All of the sessions should trigger the first event (0-10 seconds), and then they should continue triggering each new level until they leave the page. What you get is a simple count of the number of sessions that stayed the length of time in the category…not exactly like the Behavior report, but good enough for my reporting purposes.

Its been running for a couple of weeks now, and I am really pleased with the results, so I thought I’d share.


Share on LinkedInTweet about this on TwitterShare on FacebookPin on PinterestShare on Google+Email this to someone