How To Add Post Views Counter To Blogger


How To Add Post Views Counter To Blogger

This plugin is a great addition to your blog by letting your readers see how frequent the post was viewed. This might not be as accurate as GA but this plugin works like a charm, thanks to Firebase for making this possible by hosting this for FREE.

The process will require some editing on the Template section so i suggest to back up the theme first , here's how to back up your blogger theme. If your done backing up your theme lets get started.

1. Create Firebase account
Go to:
Start by creating an account , once done you will be redirected to firebase dashboard

2. Create a Project
Go to:
Click "Add a project" to get started 

Create Firebase account

3. Go to Database Tab and copy your Firebase database link
save it as we need it later

Firebase database link

4. Now go to Blogger Dashboard > Theme > Edit HTML
Copy this code then paste it before <data:post.body/> so it appears above your every post and below post title. 

<a expr:name=''/> <i class='fa fa-eye'/> <span id='postviews'/> Views
5. Add this Javascript before </body>
to find </body>  press (CTRL+F)

<script src='' type='text/javascript'/>
$.each($(&#39;a[name]&#39;), function(i, e) {
var elem = $(e).parent().find(&#39;#postviews&#39;);
var blogStats = new Firebase(&quot;; + $(e).attr(&#39;name&#39;));
blogStats.once(&#39;value&#39;, function(snapshot) {
var data = snapshot.val();
var isnew = false;
if(data == null) {
data= {};
data.value = 0;
data.url = window.location.href; = $(e).attr(&#39;name&#39;);
isnew = true;

6. Change the highlighted Red with your Firebase database link you previously saved.

Save Your theme now and the plugin works great!
To check the demo , check the views counter above my post.

How do you like this plugin? Any issue with the installation? Do let me know by leaving a comment below.