feature/7-tianji-acknowledge-banner (#11)
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
@@ -156,6 +156,6 @@ EMAIL_USE_TLS = True
|
||||
LOGIN_REDIRECT_URL = '/'
|
||||
LOGOUT_REDIRECT_URL = '/'
|
||||
|
||||
# Tianji analytics (loaded only after user consent)
|
||||
# Tianji analytics (loaded on page load; users acknowledge via notice banner)
|
||||
TIANJI_TRACKER_URL = 'https://tianji.aimloperations.com/tracker.js'
|
||||
TIANJI_WEBSITE_ID = 'cm7w80pyy020oddswy2evl957'
|
||||
|
||||
@@ -137,15 +137,14 @@
|
||||
<div id="cookie-consent-banner" class="cookie-consent-banner" hidden role="dialog" aria-modal="true"
|
||||
aria-labelledby="cookie-consent-title" aria-describedby="cookie-consent-description">
|
||||
<div class="cookie-consent-content">
|
||||
<h2 id="cookie-consent-title" class="visually-hidden">Cookie consent</h2>
|
||||
<h2 id="cookie-consent-title" class="visually-hidden">Analytics notice</h2>
|
||||
<p class="cookie-consent-text" id="cookie-consent-description">
|
||||
<span class="cookie-consent-text-full">We use analytics tracking to understand how visitors use our site. Tracking runs only if you accept.
|
||||
<span class="cookie-consent-text-full">We use analytics to understand how visitors use our site. This helps us improve performance and content.
|
||||
See our <a href="{% url 'terms_of_service' %}">Terms of Service & Privacy Policy</a> for details.</span>
|
||||
<span class="cookie-consent-text-short">We use analytics if you accept. <a href="{% url 'terms_of_service' %}">Privacy Policy</a></span>
|
||||
<span class="cookie-consent-text-short">We use analytics on this site. <a href="{% url 'terms_of_service' %}">Privacy Policy</a></span>
|
||||
</p>
|
||||
<div class="cookie-consent-actions">
|
||||
<button type="button" id="cookie-consent-decline" class="btn btn-outline">Decline</button>
|
||||
<button type="button" id="cookie-consent-accept" class="btn">Accept Analytics</button>
|
||||
<button type="button" id="cookie-consent-acknowledge" class="btn">Acknowledge</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<ul>
|
||||
<li><strong>Information you provide:</strong> name, email address, message content, and other details submitted through contact forms or account-related requests.</li>
|
||||
<li><strong>Account information:</strong> username and authentication data for authorized users of internal tools.</li>
|
||||
<li><strong>Usage and analytics data:</strong> if you accept analytics in our cookie banner, we collect information about how you interact with the site, as described in Section 4.2.</li>
|
||||
<li><strong>Usage and analytics data:</strong> information about how you interact with the site, as described in Section 4.2.</li>
|
||||
<li><strong>Technical information:</strong> browser type, device type, operating system, language, referring URLs, and similar data collected automatically when you use the site.</li>
|
||||
</ul>
|
||||
<p>
|
||||
@@ -63,9 +63,9 @@
|
||||
<h3>4.2 Analytics and Usage Tracking</h3>
|
||||
<p>
|
||||
We use Tianji, a self-hosted analytics platform, to understand how visitors use our website and internal
|
||||
tools. Tracking is enabled only after you provide consent through our cookie banner.
|
||||
tools. Analytics run when you use the site so we can measure usage and improve the experience.
|
||||
</p>
|
||||
<p>When you accept analytics, we may collect information such as:</p>
|
||||
<p>We may collect information such as:</p>
|
||||
<ul>
|
||||
<li>Pages viewed and navigation paths</li>
|
||||
<li>Approximate geographic location derived from truncated IP addresses</li>
|
||||
@@ -76,16 +76,16 @@
|
||||
</ul>
|
||||
<p>
|
||||
We do not use Tianji to sell your personal information. Analytics data helps us improve site performance,
|
||||
content, and product usability. You may decline analytics at any time using the cookie preferences link
|
||||
in the site footer. If you decline, the analytics script will not load.
|
||||
content, and product usability. We show an analytics notice when you first visit the site. You can review it
|
||||
again at any time using the cookie preferences link in the site footer.
|
||||
</p>
|
||||
<p>
|
||||
We store your consent choice locally in your browser so we can remember your preference on future visits.
|
||||
We store your acknowledgement locally in your browser so we do not show the notice on every visit.
|
||||
</p>
|
||||
|
||||
<h3>4.3 Cookies and Local Storage</h3>
|
||||
<p>
|
||||
In addition to analytics consent storage, our site uses essential cookies and session storage required for
|
||||
In addition to analytics notice storage, our site uses essential cookies and session storage required for
|
||||
authentication, security (including CSRF protection), and basic site functionality. These essential
|
||||
technologies are necessary for the site to operate and are not used for marketing analytics.
|
||||
</p>
|
||||
@@ -126,7 +126,7 @@
|
||||
<h3>4.7 Your Choices and Rights</h3>
|
||||
<p>You can:</p>
|
||||
<ul>
|
||||
<li>Accept or decline analytics tracking through our cookie banner or the cookie preferences link in the footer</li>
|
||||
<li>Acknowledge our analytics notice through the banner or review it again using the cookie preferences link in the footer</li>
|
||||
<li>Contact us to request access to, correction of, or deletion of personal information you have provided, subject to applicable law</li>
|
||||
<li>Disable non-essential browser storage or cookies through your browser settings, though essential site features may not function properly</li>
|
||||
</ul>
|
||||
|
||||
@@ -115,16 +115,20 @@ class ContactViewTests(TestCase):
|
||||
|
||||
@override_settings(DEBUG=True, TIANJI_ENABLED=True)
|
||||
class TianjiTrackingTests(TestCase):
|
||||
def test_homepage_includes_consent_banner_when_enabled(self):
|
||||
def test_homepage_includes_analytics_notice_when_enabled(self):
|
||||
response = self.client.get(reverse("public_index"))
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertContains(response, "cookie-consent-banner")
|
||||
self.assertContains(response, "cookie-consent-acknowledge")
|
||||
self.assertContains(response, "Acknowledge")
|
||||
self.assertNotContains(response, "cookie-consent-decline")
|
||||
self.assertNotContains(response, "Accept Analytics")
|
||||
self.assertContains(response, "tianji-config")
|
||||
self.assertContains(response, "tianji-consent.js")
|
||||
|
||||
@override_settings(TIANJI_ENABLED=False)
|
||||
def test_homepage_omits_consent_banner_when_disabled(self):
|
||||
def test_homepage_omits_analytics_notice_when_disabled(self):
|
||||
response = self.client.get(reverse("public_index"))
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
Reference in New Issue
Block a user