Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Reference Links

Firebase Analytics

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.

Code Block
// 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.

Code Block
 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],

Code Block
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

...