Angularfire: DEBUG_MODE trace logs in console even if AnalyticsCollectionEnabled set to false

Created on 22 Sep 2020  路  4Comments  路  Source: angular/angularfire

Version info

Angular: 9.1.12

Firebase: 7.19.1

AngularFire: 6.0.3-canary.77a9a15

How to reproduce these conditions

Steps to set up and reproduce

Active DEBUG_MODE and see analytics logs in console :

{ provide: DEBUG_MODE, useValue: true }

On click on decline button of consent popin I use : setAnalyticsCollectionEnabled(false), but analytics is still logged in console
In GA DebugView, I see no more logs, so analytics is off

constructor(private cookieConsentService: NgcCookieConsentService,
              private analytics: AngularFireAnalytics) {
  }

  ngOnInit() {
    this.statusChangeSubscription = this.cookieConsentService.statusChange$.subscribe(
      (event: NgcStatusChangeEvent) => {
        switch (event.status) {
          case 'allow':
            this.analytics.setAnalyticsCollectionEnabled(true);
            break;
          case 'deny':
            this.analytics.setAnalyticsCollectionEnabled(false);
            break;
          default:
            break;
        }
      });
  }

Most helpful comment

Ah good catch, I'll make sure that our code respects that setting rather than lean on the SDK for not sending the "logged event" to the server.

All 4 comments

I'm surprised that you see any events with @angular/[email protected] due to https://github.com/angular/angularfire/issues/2505. You may want to try to new canary that fixes that: 6.0.3-canary.77a9a15.

Thanks to communicate that fix, DebugView working now
setAnalyticsCollectionEnabled(false)working -> I can see no logs in DebugView

The issue is that DEBUG_MODE still logs analytics in console even if AnalyticsCollectionEnabled is set to false

Ah good catch, I'll make sure that our code respects that setting rather than lean on the SDK for not sending the "logged event" to the server.

Should be addressed in 6.1.0-rc.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avanderbergh picture avanderbergh  路  3Comments

Leanvitale picture Leanvitale  路  3Comments

isylhdin picture isylhdin  路  3Comments

goekaypamuk picture goekaypamuk  路  3Comments

jnupeter picture jnupeter  路  3Comments