Angularfire: Analytics: Never fired any event in Firebase Analytics/DebugView

Created on 18 Jul 2020  路  22Comments  路  Source: angular/angularfire

Version info

"dependencies": {
"@angular/animations": "~9.1.11",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.11",
"@angular/compiler": "~9.1.11",
"@angular/core": "~9.1.11",
"@angular/fire": "^6.0.2",
"@angular/forms": "~9.1.11",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.11",
"@angular/platform-browser-dynamic": "~9.1.11",
"@angular/router": "~9.1.11",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2",
"firebase": "^7.13.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.10",
"@angular/cli": "~9.1.10",
"@angular/compiler-cli": "~9.1.11",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.8.3",
"@angular-devkit/architect": ">= 0.900 < 0.1100",
"firebase-tools": "^8.0.0",
"fuzzy": "^0.1.3",
"inquirer": "^6.2.2",
"inquirer-autocomplete-prompt": "^1.0.1",
"open": "^7.0.3"
}

How to reproduce these conditions

Easy , just setup AngularFire with Analytics and Firebase ProjectId (config.json)
Dont see any event in Firebase Analytics and neither in DebugView

My AppModule is like this:

`import { BrowserModule } from '@angular/platform-browser';
import { NgModule, isDevMode } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AngularFireModule } from '@angular/fire';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { environment } from '../environments/environment';

import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HeaderComponent } from './base/header/header.component';
import { FooterComponent } from './base/footer/footer.component';
import { AboutComponent } from './base/about/about.component';
import { ContactComponent } from './base/contact/contact.component';
import { HomeComponent } from './base/home/home.component';

// Material
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatIconModule } from '@angular/material/icon';
import { MatCardModule } from '@angular/material/card';
import { AdminModule } from './modules/admin/admin.module';
import { VerifyEmailComponent } from './base/verify-email/verify-email.component';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireDatabaseModule } from '@angular/fire/database';
import {
AngularFireAnalyticsModule,
ScreenTrackingService,
DEBUG_MODE,
} from '@angular/fire/analytics';

@NgModule({
declarations: [
AppComponent,
HeaderComponent,
FooterComponent,
AboutComponent,
ContactComponent,
HomeComponent,
VerifyEmailComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireAnalyticsModule,
AngularFireAuthModule,
AngularFireDatabaseModule,
AngularFirestoreModule,
MatToolbarModule,
MatIconModule,
MatCardModule,
AdminModule,
],
providers: [
ScreenTrackingService,
{ provide: DEBUG_MODE, useFactory: () => isDevMode() },
],
bootstrap: [AppComponent],
})
export class AppModule {}
`

Debug output

No errors, but i enabled Google Analytics Debugger. I received this log in console Dev Chrome tools:

Screen Shot 2020-07-18 at 11 15 47 AM

* Screenshots *

Expected behavior

received any event in Firebase Analytics and DebugView

Actual behavior

Nothing received with Fire 6.0.2 :(
Downgraded at 5.4.2 , analytics work! Updated every call with FireAuth with auth. No conflicts since downgrade.
Surprised bumped to 6 and Analytics dont work... bug regression ?

Most helpful comment

@blasco and @MathieuG-EIT

This is a duplicate of #2505, just downgrade to 6.0.0

All 22 comments

I just tried adding Analytics to my project, and same - nothing is firing.

I just tried adding Analytics to my project, and same - nothing is firing.

While they will fix someday, you can use 5.4.2 , y'll be fine. So far, no problem with Auth, Firestore and Analytics.
I consider 6.0.x. not quite stable and still beta

the same for me, also with performance monitoring.

the same for me, also with performance monitoring.

Until now, dont need Performance Monitor..., l'll test & try Performance Monitoring this week. Im curious what it's Performance Monitoring . thanks

the same for me

Same here

Same thing... spent whole day trying all kind of different scenarios, but never got a single event fired.

@MathieuG-EIT I'm trying to rollback to AngularFire 5.4.2, but I get a 'app.firestore is not a function' Could you share with me what firebase version you use? Thank you

@blasco and @MathieuG-EIT

This is a duplicate of #2505, just downgrade to 6.0.0

@MathieuG-EIT I'm trying to rollback to AngularFire 5.4.2, but I get a 'app.firestore is not a function' Could you share with me what firebase version you use? Thank you

"dependencies": {
"@angular/animations": "~9.1.11",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.11",
"@angular/compiler": "~9.1.11",
"@angular/core": "~9.1.11",
"@angular/fire": "^5.4.2",
"@angular/forms": "~9.1.11",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.11",
"@angular/platform-browser-dynamic": "~9.1.11",
"@angular/router": "~9.1.11",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^5.0.0",
"firebase": "^7.13.1",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"

Never have problem with Firestore

@grenmath Thank you! if you are doing Server Side Rendering, Firestore couldn't be more broken... I'm going to give version 5.4.2 a try

Unfortunately, I cannot get it to work with Angular 10 and SSR, I get a TypeError: app.firestore is not a function error

@conde2 Version 6.0.0 is also not firing any events

Unfortunately, I cannot get it to work with Angular 10 and SSR, I get a TypeError: app.firestore is not a function error

Yeah i dont do SSR, just SPA with Angular 9.
Without SSR , you can ?

Without SSR it seems to be working fine, unfortunately I needed SSR. Thank you anyway for sharing

With version 6.0.0 I can confirm same behavior. It works, but not with SSR. No errors, just not firing the events. Any idea or suggestion on how to approach this issue?

Well i think , you must downgrade Angular 8 or 9.
If you really need SSR sorry i cant help you maybe Someday ill do SSR with Angular Universal.
Beware 6.0 vers 5.4 dont use same kind AngularFirestore by injection in constructor(...)
When i downgrade to 5.4 imust change every firestore instance in code! Dont have same signature

As mentioned in https://github.com/angular/angularfire/issues/2505, 6.0.3-canary.77a9a15 includes the fix for this and should be published to 6.0.3 soon. Unfortunately, it doesn't appear to fix Performance Monitoring.

Fixed in 6.0.3.

Thanks! Indeed, version 6.0.3 works for me

Edit: this works for me on Android with Capacitor, but doesn't work on iOS, because Capacitor on iOS uses a custom scheme capacitor:// but Firebase Analytics requires either http: or https:. See the referenced issue below for more details.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cre8 picture cre8  路  3Comments

harrylincoln picture harrylincoln  路  3Comments

martinyoussef picture martinyoussef  路  3Comments

jteplitz picture jteplitz  路  3Comments

mypark picture mypark  路  3Comments