fix: Fixes filtering session recordings based on group properties (no-changelog) (#30634)

This commit is contained in:
Joco-95 2026-05-18 17:37:01 +02:00 committed by GitHub
parent 3fca302df2
commit 7a7d8a615e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 0 deletions

View File

@ -96,6 +96,7 @@ declare global {
userPropertiesOnce?: Record<string, string>,
): void;
reset?(resetDeviceId?: boolean): void;
group?(groupType: string, groupKey: string, groupPropertiesToSet?: IDataObject): void;
onFeatureFlags?(callback: (keys: string[], map: FeatureFlags) => void): void;
reloadFeatureFlags?(): void;
capture?(event: string, properties: IDataObject): void;

View File

@ -64,11 +64,16 @@ export class Telemetry {
});
this.identify({ instanceId, userId, versionCli, projectId, userRole });
this.groupIdentify({ instanceId });
this.flushPageEvents();
this.track('Session started', { session_id: rootStore.pushRef });
}
groupIdentify({ instanceId }: { instanceId: string }) {
usePostHog()?.groupIdentify?.('company', instanceId);
}
identify({ instanceId, userId, versionCli, projectId, userRole }: TelemetryIdentifyOptions) {
const settingsStore = useSettingsStore();
const traits: {

View File

@ -114,6 +114,10 @@ export const usePostHog = defineStore('posthog', () => {
};
}
const groupIdentify = (groupKey: string, instanceId: string) => {
window.posthog?.group?.(groupKey, instanceId);
};
const identify = () => {
const instanceId = rootStore.instanceId;
const user = usersStore.currentUser;
@ -233,6 +237,7 @@ export const usePostHog = defineStore('posthog', () => {
waitForFeatureFlags,
reset,
identify,
groupIdentify,
setMetadata,
capture,
overrides,