Search code examples
firebaseangularfire2firebase-analytics

AngularFireAnalytics doesn't log events in DebugView


I've followed the instructions install-and-setup.md and getting-startd.md, set DEBUG_MODE to true, install google-analytics-debugger extension but anyway can't see any events in DebugView. In development tools there aren't any POST requests to analytics, only some GET to https://www.googletagmanager.com/gtag/js?l=dataLayer&dbg=7986

Repository: Repository

I've also tried to add SDK in index.html. And DebugView logging works, POST requests to https://www.google-analytics.com/g/collect... exists.

package.json

"@angular/core": "~10.0.14",
"@angular/fire": "^6.0.2",
"firebase": "^7.13.1"

app.module.ts

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

import { AngularFireModule } from '@angular/fire';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { ProfileComponent } from './profile/profile.component';
import { RulesComponent } from './rules/rules.component';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent,
    ProfileComponent,
    RulesComponent
  ],
  imports: [
    AngularFireModule.initializeApp(environment.firebase),
    AngularFireAnalyticsModule,
    BrowserModule,
    AppRoutingModule,
  ],
  providers: [
    { provide: DEBUG_MODE, useValue: true },
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Thanks in advance.


Solution

  • Seems to be a known issue with Angular Fire, you could try to use @angular/fire ^6.0.0, as mentioned in this comment here: https://github.com/angular/angularfire/issues/2505#issuecomment-672462375