Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(activity-logs): track third-party AI consent toggle (#66317)

Alex Lider65edcc7e8984
diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.py
index 9f4a0e85b135..4448046fac57 100644
--- a/posthog/models/activity_logging/activity_log.py
+++ b/posthog/models/activity_logging/activity_log.py
@@ -279,6 +279,7 @@ field_name_overrides: dict[AuditableScope, dict[str, str]] = {
"is_member_join_email_enabled": "member join email notifications",
"session_cookie_age": "session cookie age",
"default_experiment_stats_method": "default experiment stats method",
+ "is_ai_data_processing_approved": "third-party AI services",
},
"BatchExport": {
"paused": "enabled",
@@ -536,7 +537,6 @@ field_exclusions: dict[AuditableScope, list[str]] = {
"setup_section_2_completed",
"plugins_access_level",
"is_hipaa",
- "is_ai_data_processing_approved",
"never_drop_data",
],
"BatchExport": [
diff --git a/posthog/test/activity_logging/test_organization_activity_logging.py b/posthog/test/activity_logging/test_organization_activity_logging.py
index 145818fd805d..7f03199068e5 100644
--- a/posthog/test/activity_logging/test_organization_activity_logging.py
+++ b/posthog/test/activity_logging/test_organization_activity_logging.py
@@ -172,6 +172,20 @@ class TestOrganizationActivityLogging(ActivityLogTestHelper):
assert twofa_change is not None
self.assertEqual(twofa_change["after"], True)
+ def test_organization_ai_data_processing_consent_logging(self):
+ organization = self.create_organization("AI Consent Test Org")
+ self.update_organization(organization["id"], {"is_ai_data_processing_approved": False})
+
+ log = ActivityLog.objects.filter(organization_id=organization["id"], activity="updated").first()
+ assert log is not None
+ assert log.detail is not None
+ self.assertEqual(log.user, self.user)
+ changes = log.detail.get("changes", [])
+ consent_change = next((c for c in changes if c["field"] == "third-party AI services"), None)
+ assert consent_change is not None
+ self.assertEqual(consent_change["before"], True)
+ self.assertEqual(consent_change["after"], False)
+
def test_organization_membership_creation_activity_logging(self):
org_response = self.create_organization("Test Membership Org")
org = Organization.objects.get(id=org_response["id"])