Adding uberVU badge to your blog
uberVU is service that monitors how your blog entries (or other web resources) are performing in different social networks. You can integrate uberVU reaction count badge to your blog and monitor popularity of your blog entries right in your blog. In this posting I will show you how to add uberVU badge to your blog without any server-side coding.
You can find uberVU patch from uberVU tools page. There is also JavaScript given that you can use on your blog or home page. If you plan to insert this badge manually then you don’t need any additional work. But I am lazy guy and I want to put it up once so it works for all pages in my blog.
The example JavaScript is as follows (of course, uberVU may change it as they wish):
<script type="text/javascript">
var ubervu_url = "http://your-url";
var ubervu_title = "Your Page Title";
var ubervu_style = "regular";
</script>
<script type="text/javascript" src="http://badge.ubervu.com/badge.1.0.js"></script>
But here are some problems:
- you must hardcode URL of the page,
- you must hardcode page title.
With couple of lines of code you can make it work on all of your pages. If uberVU badge code looks still like this then you can use the following code that works for every page.
<script>
var url = document.location.href;
if(url.indexOf('#') > -1)
url = url.substr(0, url.indexOf('#'));
var ubervu_url = url;
var ubervu_title = document.title;
var ubervu_style = "regular";
</script>
<script type="text/javascript" src="http://badge.ubervu.com/badge.1.0.js"></script>
Basically I just find current page URL and title with JavaScript and assign them to appropriate uberVU variables. Easy! :)