Cookie Consent offers loading inline javascript blocks dynamically when user consents or if he has already consented.


<script type="text/plain" data-consent="required">
// Insert your code here
console.log('Necessary cookies allowed');
</script>

<script type="text/plain" data-consent="analytics">
// Insert your code here
console.log('Analytical cookies allowed');
</script>


When Cookie Consent has loaded it will change the type of all scripts on the page from text/plain if the user has consented to the cookie category specified in the data-consent tag.