Thursday 22 October 2020

How to include firebase analytics in Angular 10 app dashboard?

"@angular/cli": "~10.0.8",

"@angular/fire": "^6.0.3",

Can anyone weigh in on how to create a firebase analytics dashboard. Is it possible to retrieve firebase analytics events in an angular app and display the analytics in an app dashboard?

I have searched for examples of using AngularFireAnalyticsModule with Google Analytics, but haven't found any that detail the usage. I see screen_view logged in the console from angular-fire-analytics.js, but I'm not sure how I can include this info in an app dashboard.

I've followed the Getting started with Google Analytics docs and added the code to app.module.ts:

import { AngularFireAnalyticsModule, CONFIG, DEBUG_MODE, ScreenTrackingService, UserTrackingService } from '@angular/fire/analytics';

  imports: [
     AngularFireAnalyticsModule
  ],
  providers: [
    ScreenTrackingService,
    UserTrackingService,

    { provide: CONFIG, useValue: {
        send_page_view: false,
        allow_ad_personalization_signals: false,
        anonymize_ip: true
      }
    },
    { provide: DEBUG_MODE, useValue: true }
  ],

I have logged a 'notification_received' event and can see the event logged on the firebase dashboard StreamView.

export class AnalyticsComponent implements OnInit {
  constructor(
    analytics: AngularFireAnalytics,) {
    analytics.logEvent('notification_received');
  }
  ngOnInit(): void {
  }
}



from How to include firebase analytics in Angular 10 app dashboard?

1 comment: