Want To Know Turn Around Of Related Posts Or Share Links In Your Blog?

  • Share
  • Share

Track Inbound Link ClicksOn the other day, I was trying to figure out how many of my blog visitors clicked on related posts links or share links at the end of my single post. This is important for two reasons, 1) Cliks on the related posts means more page views, which ultimately results in low bounce rate and 2) Clicks on share links means more visits to your blog from social sharing sites like Digg, Stumbleupon, Delicious, Facebook and Twitter. But to know the effectiveness of the style and placement of these items on a blog, one needs to track clicks on them.

Problem Tracking User Behaviour

In my case, earlier I was using Linkwithin plugin along with YARPP plugin. Linkwithin shows related posts with thumbnails, but is not effective in search engine optimization as it uses their proprietary javascript to generate related posts. YARPP (Yet another related posts plugin) is very famous for related posts as it generates very accurate results. I was using it with simple default style. YARPP also helps in SEO as it generates pure HTML code which can be spidered by crawlers. But that was too much clutter at the end of single post on this blog. The dilemma was, I particularly liked the thumbnails with related posts but couldn’t stand for Linkwithin because of SEO reasons. So decided to use the YARPP plugin only, but with thumbnails for it. I used very good trick described by BuildInternet to show related posts with thumbnails and some funcationality in my blog theme to generate thumbs to be used with YARPP. And fianlly I was able to achieve YARPP with thumbnails.

But then after some days, I checked my Google Analytics and saw that my bounce rate was increasing and page views decreasing. So I decided to start tracking the clicks on the related posts links. I was thinking to check related posts performance with different styles and types, like with thumbnails or without it. After some googling I found out that, Google Analytics’ trackPageView can help me to do exactly what I wanted – tracking link clicks.

How trackPageView Can Help You?

trackPageView is Google Analytics feature which can help you track inbound clicks when used with links ( <a> tag ). It generates virtual page view when somebody clicks on the link which uses the trackPageView feature. There is one consideration, there are two types of Google Analytics code for tracking 1) Legacy code 2) New Asynchronous code.

For legacy code you need to use pageTracker.trackPageView method and for asynchronous code we will use _gaq.push method to track clicks. We will mainly concentrate on asynchronous code as google analytics is using that method from very long time ago and hopefully you too are using that async code only.

If you’ve confusion what kind of code you’re using, then check the below code. It’s async code which I’m using.

<script  type="text/javascript">

 var _gaq = _gaq || [ ];
 _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
 _gaq.push(['_trackPageview']);

 (function() {
 var ga =  document.createElement('script'); ga.type = 'text/javascript'; ga.async =  true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' :  'http://www') + '.google-analytics.com/ga.js';
 var s =  document.getElementsByTagName('script')[0];  s.parentNode.insertBefore(ga, s);
 })();

</script>

How to use _gaq.push method

We’ll need to insert _gaq.push code into the link we want to track.

Say <a href=”http://www.goospoos.com/2010/02/3d-glass-wallpapers/”>3D Glass Wallpapers</a> is our link.

Here’s how will you modify it to start click tracking for that link,

<a onClick=”javascript: _gaq.push(['_trackPageview', '/gp/single/bottom/related_article']);” http://www.goospoos.com/2010/02/3d-glass-wallpapers/”>3D Glass Wallpapers</a>

The code which is in bold faces i.e. onClick=”javascript: _gaq.push(['_trackPageview', '/gp/single/bottom/related_article']);” is our tracking code.

Give attention to the /gp/single/bottom/related_article part of the tracking code. It’s a virtual page identifier i.e. whenever somebody clicks on this link, it will be seen as a page view in Google Analytics report. You can use any kind of structure you want, like /myblog/single/sharelinks or /anything/you/like. Isn’t it easy? Though better way is that you give identifier in logical way, so it will be easy to identify each and every kind of tracking identifiers in GA reports.

How can you see these clicks reported in GA report?

Note that once you’ve entered tracking code, GA will take around 24-48 hours to really start tracking clicks. In GA dashboard, go to “Content” link in left sidebar. In that click on “Top Content”, you’ll be presented with detail report of top articles. At the end of that article list, you can see “Filter Page”. In the empty search box beside “Containing” drop-down, enter the virtual page view identifier i.e. /gp/single/bottom/related_article ( use your identifier structure which you have used with your links ). You’ll get number of clicks for that and that’s exactly how many times user has used related article or share links for you post.

Filter Page Views

This method can be used with any link on your blog or website. Suppose you’ve one pdf on your website and you want to know how many times it has been downloaded, you can track the clicks on that pdf link with above method.

One Consideration

Ok, before ending this article, I would like to tell you that, these virtual page views are totally fake and inflate your page view count. So you better filter them in GA not to get counted towards your total page views. To do this, you need to create new filter.

Go to Analytics Settings->Filter Manager->Add Filter and add filter name you like. Give the pattern as below to exclude all the virtual page views.

^/gp/single/

This pattern will filter all the virtual page views starting with /gp/single/. You should use your identifier structure. Keep “^” and “/” intact.

Conclusion

I would like to conclude this article with one solid example of using this trackPageView in php code of YARPP.

<a onClick=”javascript: _gaq.push(['_trackPageview', '/gp/single/bottom/related_article']);”  href=”<?php the_permalink() ?>” rel=”bookmark”>

Ok, so I believe you get the idea of how to use this with PHP code. In confusion don’t hesitate to comment and ask queries. I’ll solve them.

No comments yet... Be the first to leave a reply!