How to use Google Analytics with AngularFire?
Support for Firebase Analytics is coming to AngularFire https://github.com/angular/angularfire/issues/2178
AngularFire is now supporting Firebase Analytics since version 5.3.0.
You can update your dependencies :
"@angular/fire": "^5.2.3",
"firebase": "^7.8.0"
As mentioned by AngularFire Docs, you just have to add AngularFireAnalyticsModule
:
import { AngularFireAnalyticsModule } from '@angular/fire/analytics';
@NgModule({
imports: [
AngularFireModule.initializeApp(environment.firebase),
AngularFireAnalyticsModule
]
})
export class AppModule { }
Be sure to add your appId
and measurementId
to your config file. (retrieve from Firebase Console, after enabling Analytics).