You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
I do not know how to check whether the user is in a region where cookie consent is not required. I want users who are in a region where cookie consent is not required (USA) to opt-in by default, and users who are in a region where cookie consent is required (EU) to opt-out by default.
Currently, I have my cookie consent config set to something like this:
And currently I have my app.component.ts set up like this:
import { Component, OnInit, OnDestroy } from '@angular/core';
import { NgcCookieConsentService } from 'ngx-cookieconsent';
import { Subscription } from 'rxjs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit, OnDestroy {
//keep refs to subscriptions to be able to unsubscribe later
private statusChangeSubscription!: Subscription;
constructor(private ccService: NgcCookieConsentService){}
ngOnInit() {
this.statusChangeSubscription = this.ccService.statusChange$.subscribe(
(event: NgcStatusChangeEvent) => {
switch (event.status) {
case 'allow':
// when the user consents, we start collecting analytics.
doSomething();
break;
case 'deny':
// when the user declines, we stop collecting analytics.
doSomething();
break;
default:
// when the user dismisses the window, do nothing
break;
}
ngOnDestroy() {
// unsubscribe to cookieconsent observables to prevent memory leaks
this.statusChangeSubscription.unsubscribe();
}
}
With this logic, if the user is in a region like the US, they never "allowed" cookies, so we never start collecting analytics from the user.
Describe the idea you'd like
If the user is in a region where cookie consent law is not required, I'd like to disable the cookie consent component and opt-in the user to cookie consent. However if the user is in a region where cookie consent law is required, I'd like to enable the cookie consent component and provide them with the choice to allow or deny cookies (type: "opt-in").
Describe alternatives you've considered
Our current system does not use the location feature, which works around this issue by forcing every user to consent.
Additional context
No response
The text was updated successfully, but these errors were encountered:
bacongobbler
changed the title
Opt-in when cookie consent is not required, opt-out when it is required (GDPR)
How do I opt-in a session when cookie consent is not required?
Sep 13, 2023
Is your feature request related to a problem? Please describe
I do not know how to check whether the user is in a region where cookie consent is not required. I want users who are in a region where cookie consent is not required (USA) to opt-in by default, and users who are in a region where cookie consent is required (EU) to opt-out by default.
Currently, I have my cookie consent config set to something like this:
And currently I have my app.component.ts set up like this:
With this logic, if the user is in a region like the US, they never "allowed" cookies, so we never start collecting analytics from the user.
Describe the idea you'd like
If the user is in a region where cookie consent law is not required, I'd like to disable the cookie consent component and opt-in the user to cookie consent. However if the user is in a region where cookie consent law is required, I'd like to enable the cookie consent component and provide them with the choice to allow or deny cookies (
type: "opt-in"
).Describe alternatives you've considered
Our current system does not use the
location
feature, which works around this issue by forcing every user to consent.Additional context
No response
The text was updated successfully, but these errors were encountered: