Being able to suppress disqus embed script according to GDPR
masiorama opened this issue · 1 comments
Hello, I have a problem not related to the plugin functionality, but rather to GDPR here in Europe.
To make my clients' websites compliant to GDPR regulations I use iubenda.com, and they have a page (https://www.iubenda.com/en/help/1229-manual-tagging-blocking-cookies) to explain how to suppress external script before the user has given his consent to load the script.
Deep inside that article you can find an original disqus implementation:
<div id="disqus_thread"></div>
<script>
var disqus_shortname = 'example'; // required: replace example with your forum shortname
(function() {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
And how to modify the script in order to let iubenda scripts to temporary suppress the script:
<script type="text/plain" class="_iub_cs_activate">
var disqus_shortname = 'example'; // required: replace example with your forum shortname
(function() {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
As you can see it is just a matter of changing script tag attributes.
I would like iubenda to be able to suppress disqus, printing the second version of the code I pasted above.
Is this something that you believe could be useful for this very package or do you suggest I should clone the repo, hack my own version and use that in replace, because this is a totally different context and dependency that should not be added?
Thanks in advance!
Implemented in the above commits