Quantcast
Channel: Hacker News 50
Viewing all articles
Browse latest Browse all 9433

0 second visits according to Google Analytics | Pawel Janiak

$
0
0

Comments:"0 second visits according to Google Analytics | Pawel Janiak"

URL:http://paweljaniak.co.za/2013/05/12/0-second-visits/


12 May 2013

The majority of website visits on Google Analytics always appear to be between 0 to 10 seconds long. Here’s a brief explanation of why that is.

What happens in reality is that when a somebody visits your page, Google Analytics will drop a time-stamped cookie. When the same person visits another page on your website (or refreshes) then Google Analytics will compare the timestamp in the cookie to real time and will base the visit duration on the first page on the difference between the two.

If you have a high bounce rate where most of your visitors leave after being on just one page of your website, there will be no second data point for Google Analytics to calculate the duration and will default to setting the visit duration as 0 seconds. This means that if someone stays on your page for hours, or days even (they may leave the tab with your website open), it will still record as 0 seconds if they don’t visit a second page.

Some people like to split their articles into multiple pages, which forces people to click on a second link to continue reading, which means a second data point for GA. This is a dick-move, don’t do it.

Another solution is to have a timeout loop in JavaScript that fires off an event to the Google Analytics event tracking API. This is a bit hacky and you’ll have to choose your event names wisely if you go down this road.

A third solution would be to add a different event tracking script that fires off when somebody has scrolled past a certain point on your page. Obviously this will require planning if it’s on a website that has several layouts or length variations.

You should definitely read through the GA event tracker guide before getting started.

I decided to use Rob Flaherty’s Jquery scrolldepth plugin to do the event tracking for this site. It’s as simple as adding in the minified ~2kb file, and adding $.scrollDepth(); in a script tag. I also added the elements option to track whenever someone reached the end of the article, so I added elements: [‘.share-links’] which fires whenever the div with that class is visible in the browser window.

As per the Github page, this requires the GA async tracking snippet. See this official page on how to spend 2 minutes setting that up. As you can see below, this post has already fired off quite a few events and the average time on page is much higher than what it would normally be. It’s worth noting that a lot of this page’s views were before putting the proof in the pudding so the data are a bit skewed.


Viewing all articles
Browse latest Browse all 9433

Trending Articles