Do you want to track the number of views on your Blogger blog posts? In this tutorial, we'll show you how to add an automatic view counter to your Blogger theme, letting you and your readers know how popular your content is. Follow along step by step and see how easy it is to add this useful feature to your blog. Let's get started!
Adding an automatic view counter to your Blogger theme is a simple process that can be done in just a few steps. Here are the details on how to do it:
To get started, create a new project in Google Firebase by visiting the Firebase Console page and clicking "Create a Project." Then enter the desired project name and click “Continue” to proceed. [check image]
After creating a project name, leave the default settings as they are and click "Continue". To configure Google Analytics settings, click "Choose an account" and select the Google Analytics account you want to use, then click "Continue."
Now click and create project and it will take few seconds.
Now click Continue.
Hooray! Your project is ready to use. Click now and Real time Database
Click on Create Database. And select any database location. I am selecting United States (us-central01). After this select Lock Mode and click on Enable.
Now click on Rules. [view image]
After that remove all the rule codes and paste in the rules section below the rule code. [view image]
{
"rules": {
".read": true,
"BlogID_0000000000000000000": {
".read": true,
"$post_id": {
".write": "newData.exists() && (data.exists() ? newData.val() == data.val() + 1 : newData.val() == 1)",
".validate": "newData.isNumber() && newData.val() % 1 === 0.0 && newData.val() <= 99999999"
}
}
}
}
Don't forget to change BlogID. Replace BlogID with Your BlogID
realViews: { databaseUrl: "", abbreviation: "false" }
realViews: { databaseUrl: "https://xxxxxxx-xxx-xxx-default-rtdb.asia-southeast1.firebasedatabase.app", abbreviation: "true" }
Sorry, we detected that you have activated Ad-Blocker.
Please consider supporting us by disabling your Ad-Blocker, it helps us in developing this Website.
Thank you!