Google Analytics helps you understand how people use the web and mobile apps. Analytics helps you understand how your users behave, so we can make informed decisions about how to market our app.
Plugin used
firebase_analytics
About Firebase Console
In the Firebase console we can track the real-time user usage, Below are the main core features for tracking the user
Users in the last 30 minutes.
User's activity over time using a date picker represents inline charts.
Track the users by app version.
Track users by device Model.
User Retention.
Reference Links
Firebase Analytics
Firebase Integration in different Platforms
Select the project from Firebase Console.
Project view console will open, here we need create three apps
for three platforms(IOS, Android and Web), below are the steps to create apps for three platforms
Android
Tap on Add app and select android Icon, it will navigate to register android app page, copy paste thiscom.dwss.mgramseva
package name in first field as shown in below image, after that tap on register app button, it will generate a google-services.json, now close this window.
IOS
Tap on Add app and select IOS Icon, it will navigate to register IOS app page, copy paste thiscom.dwss.mgramseva
Apple bundle ID name in first field as shown in below image, after that tap on register app button, it will generate a google-services.json, now close this window.
Web
Tap on Add app and select script tag Icon, it will navigate to register Web app page, copy paste this mgramseva name in first field as shown in below image, after that tap on register app button, it will generate html code, now close this window.
Firebase Integration in different Platforms
User need to have access this dwss firebase analytics account.
Once you have access, navigate to the Firebase console.
Select mGramseva application from list of projects.
Tap on Project over view option, there you can see all the created Apps.
Beside the project overview option one gear option(settings) will be there tap on that, all the created applications will be listed out there.
Below are the steps for integrating the Firebase for all three platforms(IOS, Android, Web).
Integration With Android
In general tab select the Android App and tap on the See SDK Instruction option, here clear instruction will be there how to include google service json file, follow those steps.
Integration With IOS
In general tab select the IOS App and tap on the See SDK Instruction option, here clear instruction will be there how to include google service json file, follow those steps.
Integration With Web
In general tab select the Web App and follow the steps under the SDK setup and configuration.
// 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: "AIzaSyCKH_N1mdr3W_7fL8BkYlmY-U9RaWcUopc", authDomain: "mgramseva-9e2ed.firebaseapp.com", projectId: "mgramseva-9e2ed", storageBucket: "mgramseva-9e2ed.appspot.com", messagingSenderId: "175269434038", appId: "1:175269434038:web:5cf8d5d1e1dc54700dcc17", measurementId: "G-MY9HZBBBC8" }; // Initialize Firebase const app = initializeApp(firebaseConfig); const analytics = getAnalytics(app);
Methods Utilized to log the Data in Firebase
By default firebase track the app version, device model, and location. Below methods are used to track the screen data.
static FirebaseAnalytics analytics = FirebaseAnalytics(); static FirebaseAnalyticsObserver observer = FirebaseAnalyticsObserver(analytics: analytics); /// Add this line in Material App widget to track the screen navigation navigatorObservers: <NavigatorObserver>[observer],
if (kIsWeb) { FirebaseAnalytics analytics = FirebaseAnalytics(); analytics.logEvent(name: "screen_view", parameters: { 'firebase_screen': "$path", 'screen_name': "$path", }); }
Files Path
https://github.com/misdwss/punjab-mgramseva/blob/master/frontend/mgramseva/lib/main.dart https://github.com/misdwss/punjab-mgramseva/blob/master/frontend/mgramseva/web/index.html https://github.com/misdwss/punjab-mgramseva/blob/master/frontend/mgramseva/android/app/google-services.json
Add Comment