Here, the simplest trick to feature How To Add Post Views Counter in Blogger. After reading this you never search for display post views counters in blogger or how to add post views counter to blogger.
How To Add Post Views Counter in Blogger:- Its purpose is for our readers to ascertain which of our posts are viewed mostly by others. it's also for us - admins, to watch the post views within the front of our blog and to understand which of our posts get the interests of our readers. Blogger blogs can now easily add a counter of post views by Firebase.
How To Add Post Views Counter in Blogger:- Its purpose is for our readers to ascertain which of our posts are viewed mostly by others. it's also for us - admins, to watch the post views within the front of our blog and to understand which of our posts get the interests of our readers. Blogger blogs can now easily add a counter of post views by Firebase.
How To Add Post Views Counter in Blogger
Just follow these steps to Add Post Views Counter in Blogger
Creating your Firebase Account
Signup to Firebase
Then, create your Firebase APP
Now, change your database rules:-
Note:- Copy your Firebase App URL.
Add Post Views Counter in Blogger
Go to Blogger » Go To Template » (recommended) Backup your Template » and now Edit HTML
Copy the code and paste it before <data:post.body/>
<a expr:name='data:post.id'/> <i class='fa fa-eye'/> <span id='postviews'/> Views
Or paste it where you want to show your views counter.
Now,
Copy the given code below code & paste it just above of </body>
<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');
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>
Change the colored text with your firebase id.
And,
And,
Save your Template.
We hope you get post views counters in blogger. Share for anyone who needs to know about How To Add Post Views Counter in Blogger. This was the only best trick for your question of how to add post views counter to blogger.
>Finally, You Got It..!!<
We hope you get post views counters in blogger. Share for anyone who needs to know about How To Add Post Views Counter in Blogger. This was the only best trick for your question of how to add post views counter to blogger.
Great!! It works perfectly.
ReplyDeleteThis is awesome article. This trick works perfectly.
ReplyDelete