Firebase: Views & Likes
To enable dynamic data retrieval on your website, we support Firebase integration. This allows you to use view count functionality in lists and articles.
- Visit Firebase and create an account
- Create a new project
- Select analytics location
- Blowfish integrates with Firebase through Firebase-related parameters in the
params.tomlconfiguration file. For more details, refer to this page. You can find an example Firebase integration file below. Please note the parameters within the FirebaseConfig object.
// Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getAnalytics } from "firebase/analytics";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyB5tqlqDky77Vb4Tc4apiHV4hRZI18KGiY",
authDomain: "blowfish-21fff.firebaseapp.com",
projectId: "blowfish-21fff",
storageBucket: "blowfish-21fff.appspot.com",
messagingSenderId: "60108104191",
appId: "1:60108104191:web:039842ebe1370698b487ca",
measurementId: "G-PEDMYR1V0K"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
- Set up Firestore - Select Build and open Firestore. Create a database and start in production mode. Choose server location and wait for deployment to complete. After startup, you need to configure rules. Simply copy and paste the content below, then click publish.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
- Enable anonymous authentication - Select Build and open Authentication. Choose Get started, click Anonymous and enable it, then save.
- Enjoy - You can now activate the article view count and like functionality in Blowfish.
No articles published here yet.
