Yes you heard it right, all BlogSpot blogs will now be able to display a dynamic count for individual pageviews. We can now easily create this post view counter without worrying about servers or server code. With a free service like Firebase you can now create dynamic and data-driven plugins for blogger without worrying about backend development. Firebase was launched in April 2012 and since then it had been the hub for developers. Amazingly this free plan gives you 10GB Free bandwidth and 5GB Free storage. Which in our case is more than required! We had been lucky to utilize this free service for blogger platform and create some amazing scripts with the help of our developer Ahmed Nasir. Today's tutorial will help you to install a dynamic script that will automatically increment its initial count value when a visitor views your blog posts. The counter data will be stored on a free database provided by Firebase. Lets first see a demo!Demo
Note: The postviews count wont change when you refresh the blog homepage but it will change only when you visit individual posts.
In order to gain access to a free database and be able to keep a backup of your postviews counter data, you must sign up for a free account at Firebase.
Fill up the easy steps sensibly and then once your account has been activated, you must create your first Firebase database.
You can create 2 firebases. At present just create one, we will guide you later in coming posts about amazing things you can play with this free service.
Towards the bottom right side of your account, you will find the following submit box.2. Inside this box input your website name. In my case I inserted mybloggertricks and this generated the following firebase URL: https://mybloggertricks.firebaseio.com
3. Finally hit the create button and note down your firebase URL because we would need it later in this tutorial.
Go To Blogger > Template Backup your template Click Edit HTML Tick the box "Expand widget Templates" Search for ]]> Just above it paste the following CSS code:/*-------- Post Views ----------*/
#views-container {
width: 85px;
float: right;
}.mbtloading {
background: url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBFWPiG0D4GVS5j0NwdWRWPMCejjKX8_wcN99KlJZrc7beN5ISIV6QLlJWHFWXLrEp5VQ5wjMgZCO5qd5VEl5vtMRTjrMMNqOdXc-bgwpsiplNuvb0obGJQ4BoaJHD-KNbt98sqhaZk9xr/s320/mbtloading.gif') no-repeat left center;
width: 16px;
height: 16px;
}.viewscount {
float: right;
color: #EE5D06;
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/AVvXsEh1UQwkd33EJ1KcLs-XLTrue6aSdrk2SLWTn1xZLLoMAmjrKsN2taCJw9Dh2Nm7o7pTp4erDgujRC_VMzMEVr67FoxlGnsH09N6TX_X1qld_SBDUChU3n75Qnxk975GzHVImKa39roJvEaI/s1600/postviews.png') no-repeat left;
border: 0px;
display: block;
width: 16px;
height: 16px;
float: left;
padding: 0px 2px;
}
Customizations:
To change the text color of the numeric count, edit #EE5D06 To change the plugin alignment, change right to left.7. Next search for
No comments:
Post a Comment