Hello! Welcome to Tecky AaryaN.
![]() |
© Copyright 2024 Techy AaryaN |
Adding an automatic view counter to your Blogger theme is a simple process that can be done in just a few steps. Here's a breakdown of how to do it:
1. Create a Database on Google Firebase
To begin, create a new project on 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 is and click "Continue." To configure Google Analytics settings, click "Select an account" and choose the Google Analytics account in use, then click "Continue.
Now click create project and it will take few seconds.
Your project is ready to use. Now click on Realtime Database
Click on Create Database. And selete any Database Location. I am Selecting United State (us-central01). After that slect the lock mode and click Enable.
Now click on rules. [See Image]
After that remove all rule code and paste below rules code in rule section. [See Image]
Now copy the Database Url
JSON CODE Rules
For Single Site
{
"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"
}
}
}
}
{ "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" } }, "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" } }, "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
The code look like below.realViews: { databaseUrl: "", abbreviation: "false" }
realViews: {
databaseUrl: "https://example-rtdb.firebaseio.com",
abbreviation: "false"}