Change Tianji tracking from opt-in consent to acknowledge banner #7

Closed
opened 2026-07-02 04:25:21 -07:00 by westfarn · 0 comments
Owner

Problem

Tianji analytics currently uses an opt-in consent model. The tracker script (tracker.js) loads only after a user clicks Accept Analytics on the cookie banner. If a visitor never interacts with the banner, no tracking data is collected — we lose visibility into a large portion of site traffic.

Current flow (public/static/public/js/tianji-consent.js):

  • No stored consent → banner shown, tracker not loaded
  • accepted → tracker loaded
  • declined → tracker not loaded, tianji.disabled set in localStorage

Proposed change

Switch from accept/decline consent to an acknowledge/inform model:

  • Load Tianji tracking by default (or immediately on page load)
  • Replace the consent banner with an informational notice that analytics are in use
  • Primary action becomes Acknowledge (or similar) — dismisses the banner and records that the user has seen the notice
  • Remove or repurpose the Decline button (no longer blocks tracking)
  • Update copy to reflect that analytics run to help us understand site usage, with a link to the privacy policy

Files likely affected

  • public/static/public/js/tianji-consent.js — core consent/loading logic
  • public/templates/base.html — banner copy and button labels (cookie-consent-banner)
  • public/templates/public/terms_of_service.html — Section 4.2 and related privacy language (currently states tracking is "enabled only after you provide consent")
  • public/tests.pyTianjiTrackingTests assertions
  • company_site/settings.py — comment on line 159 ("loaded only after user consent")

Acceptance criteria

  • Tianji tracker loads for all visitors regardless of banner interaction
  • Banner text and buttons updated from accept/decline to acknowledge model
  • Acknowledging dismisses the banner and persists preference in localStorage (so it does not reappear every visit)
  • First-time visitors who never click still produce analytics data
  • Terms of Service / Privacy Policy language updated to match new behavior
  • Existing tests updated; new behavior covered where appropriate
  • Footer "Cookie Preferences" link still works (likely re-shows the notice rather than a consent toggle)

Notes

  • Review legal/compliance implications of moving from opt-in to notice-only analytics before deploying.
  • Consider whether consent_accepted / consent_declined Tianji events should be renamed (e.g. notice_acknowledged).
  • Users who previously chose declined in localStorage may need a migration path so they are not permanently excluded.
## Problem Tianji analytics currently uses an **opt-in consent model**. The tracker script (`tracker.js`) loads only after a user clicks **Accept Analytics** on the cookie banner. If a visitor never interacts with the banner, no tracking data is collected — we lose visibility into a large portion of site traffic. Current flow (`public/static/public/js/tianji-consent.js`): - No stored consent → banner shown, tracker **not** loaded - `accepted` → tracker loaded - `declined` → tracker not loaded, `tianji.disabled` set in localStorage ## Proposed change Switch from **accept/decline consent** to an **acknowledge/inform** model: - Load Tianji tracking by default (or immediately on page load) - Replace the consent banner with an informational notice that analytics are in use - Primary action becomes **Acknowledge** (or similar) — dismisses the banner and records that the user has seen the notice - Remove or repurpose the **Decline** button (no longer blocks tracking) - Update copy to reflect that analytics run to help us understand site usage, with a link to the privacy policy ## Files likely affected - `public/static/public/js/tianji-consent.js` — core consent/loading logic - `public/templates/base.html` — banner copy and button labels (`cookie-consent-banner`) - `public/templates/public/terms_of_service.html` — Section 4.2 and related privacy language (currently states tracking is "enabled only after you provide consent") - `public/tests.py` — `TianjiTrackingTests` assertions - `company_site/settings.py` — comment on line 159 ("loaded only after user consent") ## Acceptance criteria - [ ] Tianji tracker loads for all visitors regardless of banner interaction - [ ] Banner text and buttons updated from accept/decline to acknowledge model - [ ] Acknowledging dismisses the banner and persists preference in localStorage (so it does not reappear every visit) - [ ] First-time visitors who never click still produce analytics data - [ ] Terms of Service / Privacy Policy language updated to match new behavior - [ ] Existing tests updated; new behavior covered where appropriate - [ ] Footer "Cookie Preferences" link still works (likely re-shows the notice rather than a consent toggle) ## Notes - Review legal/compliance implications of moving from opt-in to notice-only analytics before deploying. - Consider whether `consent_accepted` / `consent_declined` Tianji events should be renamed (e.g. `notice_acknowledged`). - Users who previously chose `declined` in localStorage may need a migration path so they are not permanently excluded.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/company_site#7