Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(telemetry): skip groupIdentify when event is marked anonymous

Devin AI24fd3748bc44
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.ts
index 5b6e0ca17e..dd805f15fc 100644
--- a/backend/src/services/telemetry/telemetry-service.ts
+++ b/backend/src/services/telemetry/telemetry-service.ts
@@ -267,7 +267,22 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
})
);
} else {
- if (event.organizationId) {
+ // Skip groupIdentify entirely when the event is marked anonymous.
+ //
+ // posthog-node implements `groupIdentify` as a regular capture of a
+ // `$groupidentify` event keyed by the supplied `distinctId`. For an
+ // anonymous-share viewer of an org-scoped share, that `distinctId`
+ // is the synthesised `anonymous-<shareId>` value, so calling
+ // groupIdentify here would create exactly the per-share person
+ // record we are trying to suppress — defeating the
+ // `$process_person_profile: false` flag we set on the explicit
+ // capture below. Org-level attribution on the captured event itself
+ // is still preserved via the `groups` field, so analytics that
+ // slice by organization continue to work; only the periodic refresh
+ // of the org's group properties is skipped on this code path.
+ // Authenticated events for the same org refresh those properties
+ // frequently anyway, so there is no analytical loss.
+ if (event.organizationId && !event.anonymous) {
const orgId = event.organizationId;
// Dedup groupIdentify: only fire once per org per hour to avoid redundant DB/API calls
const groupIdentifyCacheKey = KeyStorePrefixes.TelemetryGroupIdentify(orgId);