Skip to content

DEBUG_MODE trace logs in console even if AnalyticsCollectionEnabled set to false #2593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
manon-dm opened this issue Sep 22, 2020 · 4 comments

Comments

@manon-dm
Copy link

manon-dm commented Sep 22, 2020

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;
        }
      });
  }

@Splaktar
Copy link
Contributor

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

@manon-dm
Copy link
Author

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

@manon-dm manon-dm changed the title setAnalyticsCollectionEnabled not working DEBUG_MODE trace logs in console even if AnalyticsCollectionEnabled set to false Sep 25, 2020
@jamesdaniels
Copy link
Member

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.

@jamesdaniels
Copy link
Member

Should be addressed in 6.1.0-rc.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants