More and more jurisdictions in the world have requirements regarding user data. You may need to prompt your users to consent to or decline to being tracked. There is no addon in Vanilla that is a "plug and play" solution. You can, however, leverage our Pockets addon to build your own HTML/Javascript solution.
Please see this article about cookies used in Vanilla. The only other way your users are tracked is through our Vanilla Analytics feature which you can opt a user out of by setting the Javascript variable gdn.meta.AnalyticsTask
to false
on every page load for anyone who does not consent to be tracked.
Roughly, how some communities have done this is in a pocket, in the Head location, check if the user has consented or not and turn of the Analytics tracker for that person:
<!--
This is not tested code. For demonstration purposes.
-->
<script>
// Add a function to read the cookie.
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
// Set it so that analytics won't track the user.
gdn.meta.AnalyticsTask=false;
// Check if the user has given consent.
let cookieConsent = getCookie('consent');
// If the user has given consent set the track to track them.
if (cookieConsent) {
gdn.meta.AnalyticsTask='tick';
}
</script>
In another pocket build out a javascript button that, when submitted sets the consent cookie:
document.cookie = 'consent=true;domain=.[your-domain];path=/';
Note that the %-vA
cookie, the Vanilla Analytics cookie, will still be set, only now it is not tracking anything.