Skip to content
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

[Feat]: Toggle script with multiple data-categories #671

Open
KotaruS opened this issue Apr 9, 2024 · 1 comment
Open

[Feat]: Toggle script with multiple data-categories #671

KotaruS opened this issue Apr 9, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@KotaruS
Copy link

KotaruS commented Apr 9, 2024

Description

It might be useful to be able to apply simple OR or AND in data-category so It's loaded when either or both categories are granted. I know about onChange and onConsent but solution like this provides extra flexibility with some CMS solutions.

Proposed solution

Example OR:

<script type="text/plain" data-category="analytics|marketing">
// gets loaded when analytics or marketing consent is granted
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
</script>

Example AND:

<script type="text/plain" data-category="analytics&marketing">
// gets loaded when both analytics and marketing consent is granted
gtag('consent', 'update', { 
  'analytics_storage': 'granted',
  'ad_user_data': 'granted',
  'ad_personalization': 'granted',
  'ad_storage': 'granted',
});
</script>

Additional details

No response

@KotaruS KotaruS added enhancement New feature or request triage yet to be reviewed labels Apr 9, 2024
@orestbida orestbida removed the triage yet to be reviewed label Apr 24, 2024
@orestbida
Copy link
Owner

Yes, could be useful!

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

No branches or pull requests

2 participants