umgc / fall2022

SWEN 670 Fall 2022 cohort
Creative Commons Zero v1.0 Universal
4 stars 3 forks source link

Develop: Add Google Analytics integration #411

Closed mdconatser closed 1 year ago

mdconatser commented 2 years ago

As an administrator of the application, I would like Google Analytics support to be added so that I can see an automated dashboard of various usage metrics.

Acceptance Criteria

cthorn2 commented 2 years ago

Still working on integrating Google Analytics further within the app, but I have limited analytics coming back at this point. I live in Carney, MD and it's able to pull that information in real-time on the emulator. Tomorrow, I would like to see about capturing more information navigating within the app (screen views) and also capturing outbound links.

Image

Reconfigured to add the new umgc.swen account information.

Google Analytics already tracks a default set of attributes.

Firebase Instance Initialization

//check to make sure the instance has been initialized, so multiple instances are not getting instantiated.

  if (Firebase.apps.length == 0) {
      await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform,);
  }

UI Navigation

// there are two options for setting the screenName attribute to monitor this change.

FirebaseAnalytics.instance.setCurrentScreen(screenName: "Main Menu");

or

    FirebaseAnalytics.instance.logEvent(
      name: 'screen_view',
      parameters: {
        'screenName': 'Main Menu',
        'screenClass': 'main_menu.dart',
      },
    );

Link Tracking

// Need more information, right now links are striped from email messages. Still researching

You should be able to log into Google Firebase or Analytics tomorrow afternoon/evening to see information from today. It takes 24hours to update.

cthorn2 commented 2 years ago

Pushed feature/411 to GitHub this afternoon.