cookieconsent
cookieconsent copied to clipboard
[Feat]: Toggle script with multiple data-categories
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
Yes, could be useful!