Cookie Consent
Learn how to implement cookie consent and manage user privacy preferences.
When is Consent Required?
TwoBucks is designed to be privacy-friendly and does not use cookies by default. However, if you use the identify() feature to track logged-in users, you may need to obtain consent depending on your jurisdiction (e.g., GDPR in Europe).
Consent Management
TwoBucks checks for a localStorage flag to determine if tracking is allowed. You can integrate this with your existing cookie banner.
Granting Consent
To enable tracking (if disabled by default):
localStorage.setItem('twobucks_consent', 'true');Revoking Consent
To disable tracking:
localStorage.removeItem('twobucks_consent');
// Optional: Explicitly ignore
localStorage.setItem('twobucks_ignore', 'true');Example Implementation
Here is a simple example of a cookie consent banner:
function showBanner() {
if (!localStorage.getItem('twobucks_consent') && !localStorage.getItem('twobucks_ignore')) {
document.getElementById('cookie-banner').style.display = 'block';
}
}
function acceptCookies() {
localStorage.setItem('twobucks_consent', 'true');
document.getElementById('cookie-banner').style.display = 'none';
// Reload to start tracking immediately if script was blocked
window.location.reload();
}
function declineCookies() {
localStorage.setItem('twobucks_ignore', 'true');
document.getElementById('cookie-banner').style.display = 'none';
}Do Not Track (DNT)
TwoBucks respects the browser's "Do Not Track" setting. If a user has enabled DNT in their browser settings, we will not track them, regardless of the consent flags.
Checklist for Compliance
- Update your Privacy Policy to mention TwoBucks Analytics
- Explain what data is collected (see Privacy page)
- Provide a way for users to opt-out
- If using
identify(), obtain explicit consent