Angular: 9.1.12
Firebase: 7.19.1
AngularFire: 6.0.3-canary.77a9a15
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;
}
});
}
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
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.