How to add Post Viewers counter widget to Blogger?
Important step: First sign up on Firebase.com and create an app with any name and get the url as seen below
Now follow the below steps.....
1. Search for the following code
]]></b:skin>
2. Add the below code above "]]></b:skin>"
/*-------- Post Views ----------*/#views-container {width: 85px;float: right;}.mbtloading {background: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHDzOpMKhSzThoZfCDagC4CviCZnlWbFF0Ba9apwhhmUTVFghEtua2fGEI7FEWt2M-9fe6N9ZxEsRDhON143c3gzhJev1vTYGiUW9L_CDj9-757nFnoyvumJZizsSEmib3ktGiezWRpdE8/s320/mbtloading.gif') no-repeat left center;width: 16px;height: 16px;}.viewscount {float: right;color: #E68A00;font: bold italic 14px arial;}.views-text {float: left;font: bold 12px arial;color: #333;}.views-icon{background: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-e0zCAW2HsM78nyP-QejwGjT-KFLeAs2iSkDJHjfPNsBzokKMfH9fmwKDOUinbGB8dGTGMk3J8hHitNHmuyNJaseioTR4K6SyPrYoW_TF9o7GPmTnRdpquJMlzvEPVDFmvVXDh7-gjqk/h120/stats.gif') no-repeat left;border: 0px;display: block;width: 16px;height: 16px;float: left;padding: 0px 2px;}
3. Search for the one of the below code
<data:post.body/>
or
<div class='post-footer-line post-footer-line-1'>
or
<div class='post-footer-line post-footer-line-2'>
or
<div class='post-footer-line post-footer-line-3'>
4. Paste below code below/above one of the above code.
<b:if cond='data:blog.pageType == "item"'><!-- Post Views Counter --><div id='views-container'><span class='views-icon'/><div class='views-text'>Views:</div> <div class='mbtloading viewscount' id='postviews'/></div></b:if>
5. Search for the below tag.
</body>
6. Now add the below code above "</body>"
<!-- Post Views Script --><script type='text/javascript'> window.setTimeout(function() { document.body.className = document.body.className.replace('loading', ''); }, 10); </script><script src='https://cdn.firebase.com/v0/firebase.js' type='text/javascript'/><script>$.each($('a[name]'), function(i, e) {var elem = $(e).parent().find('#postviews').addClass('mbtloading');var blogStats = new Firebase("https://cstufians.firebaseio.com/pages/id/" + $(e).attr('name'));blogStats.once('value', function(snapshot) {var data = snapshot.val();var isnew = false;if(data == null) {data= {};data.value = 0;data.url = window.location.href;data.id = $(e).attr('name');isnew = true;}elem.removeClass('mbtloading').text(data.value);data.value++;if(window.location.pathname!='/'){if(isnew)blogStats.set(data);elseblogStats.child('value').set(data.value);}});});</script>
7. Replace cstufians.firebaseio.com with your firebase url.
8. Enjoy the widget and post your reviews...
Next
« Prev Post
« Prev Post
Previous
Next Post »
Next Post »
ConversionConversion EmoticonEmoticon