Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

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 App Creation for Multi-Platforms

  • Select the project from Firebase Console.

  • Project view console will open, here we need to create three apps
    for three platforms(IOS, Android and Web), below are the respective 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 this com.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, successfully app was created, now close this window.


    IOS
    Tap on Add app and select IOS Icon, it will navigate to register IOS app page, copy paste this com.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, download on the google-services.json as shown in below image.

  • Add this Json file to the android app folder as shown in below image.

Integration With IOS

  • In general tab select the IOS App and download on the GoogleService-Info.plist as shown in below image.

  • Add this plist file to the ios app folder as shown in below image.


Integration With Web

In general tab select the Web App and scroll to the SDK setup and configuration, In that we can find the firebaseConfig object as shown in below, upload that object to S3 bucket using below aws command.

const firebaseConfig = {
  apiKey: "AIzaSyCNeX_MlTZXOVl_7pf5S0hVnd4a******",
  authDomain: "mgramseva-qa-****.firebaseapp.com",
  projectId: "mgramseva-qa-*****",
  storageBucket: "mgramseva-qa-*****.appspot.com",
  messagingSenderId: "1274078******",
  appId: "1:127407896491:web:a3508fdb2a0f045******",
  measurementId: "G-8H6W5D****"};

Command → aws s3 cp path s3://bucket_name/firebaseConfigs.js --acl public-read

Place the below code in respective environment yaml file and replace the src attribute with valid url.

frontend-mgramseva:
  custom-js-injection: |
    sub_filter.conf: "
      sub_filter  '<head>' '<head>
      <script src=https://s3_bucket_path/firebaseConfigs.js type=text/javascript></script>
      ';"

Below was the reference PR which is used to made dev and QA changes
https://github.com/misdwss/iFix-DevOps/pull/286/files

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

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.