Privacy & Consent - HL Vanilla Community
<main> <article class="userContent"> <p>More and more jurisdictions in the world have requirements regarding the handling of users' personal data, known as <strong>personally identifiable information</strong> or <strong>PII</strong>. Because of this, you may need to prompt your users to consent or decline to being tracked. </p><p>In addition to the typical practice of tracking <a href="https://success.vanillaforums.com/kb/articles/86-cookies-used-in-vanilla" rel="nofollow noreferrer ugc">via cookies</a>, there's only one way users are tracked in <strong>Higher Logic Vanilla</strong>: </p><ul><li>through our <a href="https://success.vanillaforums.com/kb/articles/343-vanilla-analytics" rel="nofollow noreferrer ugc">Vanilla Analytics </a>feature, which you can opt a user out of by setting the JavaScript variable <code class="code codeInline" spellcheck="false" tabindex="0">gdn.meta.AnalyticsTask</code> to <code class="code codeInline" spellcheck="false" tabindex="0">false</code> on every page load for anyone who does not consent to be tracked.</li></ul><p>While there's no way to achieve this with a simple click of a button, you can leverage custom JavaScript in our Style Guide (or a custom HTML Pocket) to build your own solution. Some communities have done this is by placing a script in the <strong>JavaScript </strong>tab of their<strong> Style Guide</strong> to check if the user has consented or not, and then turn off the Analytics tracker for that person:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">// This is not tested code. For demonstration purposes only. // 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'; } </pre><p>In a custom HTML Widget in the Layout Editor (or a custom HTML Pocket), build out a JavaScript button that, when submitted sets the consent cookie:</p><pre class="code codeBlock" spellcheck="false" tabindex="0">document.cookie = 'consent=true;domain=.[your-domain];path=/'; </pre><p><strong>📝 NOTE</strong>: The <code class="code codeInline" spellcheck="false" tabindex="0">%-vA</code> cookie, the Vanilla Analytics cookie, will still be set, only now it is not tracking anything.</p> </article> </main>