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(web-analytics): Make all Web Analytics notifications archivable (#70836)

Jordan Mryyanff1390ddc392
diff --git a/products/web_analytics/backend/achievements/tasks.py b/products/web_analytics/backend/achievements/tasks.py
index 3546a22b23b0..6d467d345c0d 100644
--- a/products/web_analytics/backend/achievements/tasks.py
+++ b/products/web_analytics/backend/achievements/tasks.py
@@ -253,6 +253,7 @@ def _send_unlock_notification(ctx: EvalContext, track: TrackDefinition, stage: i
target_type=target_type,
target_id=target_id,
priority=Priority.NORMAL,
+ archivable=True,
source_url=f"/project/{ctx.team.id}/web",
)
)
diff --git a/products/web_analytics/backend/temporal/digest_notification/activities.py b/products/web_analytics/backend/temporal/digest_notification/activities.py
index a01b123eab2a..3d61bd648611 100644
--- a/products/web_analytics/backend/temporal/digest_notification/activities.py
+++ b/products/web_analytics/backend/temporal/digest_notification/activities.py
@@ -238,6 +238,7 @@ def _send_digest_notification(
target_id=str(user.id),
resource_type="web_analytics",
priority=Priority.NORMAL,
+ archivable=True,
source_url=f"/project/{busiest_team_id}/web?utm_source=web_analytics_digest&utm_medium=in_app",
metadata=_build_digest_metadata(busiest),
)
diff --git a/products/web_analytics/backend/test/test_achievements_tasks.py b/products/web_analytics/backend/test/test_achievements_tasks.py
index 1ea8c40441b7..a02f48ded109 100644
--- a/products/web_analytics/backend/test/test_achievements_tasks.py
+++ b/products/web_analytics/backend/test/test_achievements_tasks.py
@@ -93,6 +93,7 @@ class TestRecomputeTask(BaseTest):
with self.captureOnCommitCallbacks(execute=True):
self._run_user(make_evaluators(loyal_days=lambda ctx: 5))
self.assertEqual(mock_notify.call_count, 1)
+ self.assertTrue(mock_notify.call_args.args[0].archivable)
def test_unlock_notification_skipped_when_achievements_flag_disabled(self) -> None:
with patch("posthoganalytics.feature_enabled", return_value=False):
diff --git a/products/web_analytics/backend/test/test_digest_notification_activities.py b/products/web_analytics/backend/test/test_digest_notification_activities.py
index 1cbc97c814f2..587ffdab1b3c 100644
--- a/products/web_analytics/backend/test/test_digest_notification_activities.py
+++ b/products/web_analytics/backend/test/test_digest_notification_activities.py
@@ -106,6 +106,7 @@ class TestBuildAndSendForOrg(_DigestNotificationTestBase):
assert data.target_id == str(self.user.id)
assert data.team_id == self.team.id
assert data.resource_type == "web_analytics"
+ assert data.archivable is True
assert "utm_source=web_analytics_digest" in data.source_url
def test_test_arm_records_exposure_and_captures_sent_event(self):