How To Add Views Counter to your Article on Your Blogger Post





How To Add Views Counter to your Article on Your Blogger Post



We have noticed many articles that show post views to blogger post and here I find an easy way to add it. An example of the view counter on the blog is as in the above image. And a number of views in an article certainly gives the benefit of making visitors know which articles are most viewed so they know that the article is really useful.


Note: First Backup and save the theme before you start following the below steps.

The following step by step in creating a view counter on blogger:


1. Go To HTML>>Template>>Edit HTML


2. Find .showAuthor in html or you can find it with CTRL+F and write  .showAuthor


post views counter blogger wordpress blogger post


3. Paste the script above all. ShowAuthor as shown below

<a expr:name='data:post.id'/> <i class='fa fa-eye'/> <span id='postviews'/> Views

how to see blog post views
.


how to see blog post views
.


post views counter blogger wordpress blogger post



4.Paste This Script above </body> in your Html as shown below


<script src='https://cdn.firebase.com/v0/firebase.js' type='text/javascript'></script>
<script>
$.each($("a[name]"), function(i, e) {
var elem = $(e).parent().find("#postviews");
var blogStats = new Firebase("https://YOUR-APP-NAME.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.text(data.value);
data.value++;
if(window.location.pathname!="/")
{
if(isnew)
blogStats.set(data);
else
blogStats.child("value").set(data.value);
}
});
});
</script>


how many users view your blog post


5. Save the script and then you can see the result.




Subscribe to 
YoyoTechTips and follow us on Facebook and TwitterGet all Tech News, Blogging Tips, Freelancing Tips, Computer Tips, Earn Money Online, Android, How to. Reviews check out YoyoTechTips.com


Copyright © YoYoTechTips
Newer Posts Older Posts

Related posts