Wire up more posthog properties and interactions (#7763)

This commit is contained in:
Michael Telatynski 2022-02-10 13:53:07 +00:00 committed by GitHub
parent be324df953
commit 20e9d0c159
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 43 additions and 8 deletions

View file

@ -1040,6 +1040,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
this._enabledMetaSpaces = metaSpaceOrder.filter(k => enabledMetaSpaces[k]) as MetaSpace[];
this._allRoomsInHome = SettingsStore.getValue("Spaces.allRoomsInHome");
this.sendUserProperties();
this.rebuildSpaceHierarchy(); // trigger an initial update
@ -1056,6 +1057,15 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
}
}
private sendUserProperties() {
const enabled = new Set(this.enabledMetaSpaces);
PosthogAnalytics.instance.setProperty("WebMetaSpaceHomeEnabled", enabled.has(MetaSpace.Home));
PosthogAnalytics.instance.setProperty("WebMetaSpaceHomeAllRooms", this.allRoomsInHome);
PosthogAnalytics.instance.setProperty("WebMetaSpacePeopleEnabled", enabled.has(MetaSpace.People));
PosthogAnalytics.instance.setProperty("WebMetaSpaceFavouritesEnabled", enabled.has(MetaSpace.Favourites));
PosthogAnalytics.instance.setProperty("WebMetaSpaceOrphansEnabled", enabled.has(MetaSpace.Orphans));
}
private goToFirstSpace(contextSwitch = false) {
this.setActiveSpace(this.enabledMetaSpaces[0] ?? this.spacePanelSpaces[0]?.roomId, contextSwitch);
}
@ -1129,6 +1139,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
if (this.enabledMetaSpaces.includes(MetaSpace.Home)) {
this.rebuildHomeSpace();
}
this.sendUserProperties();
}
break;
}
@ -1159,6 +1170,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
}
this.emit(UPDATE_TOP_LEVEL_SPACES, this.spacePanelSpaces, this.enabledMetaSpaces);
this.sendUserProperties();
}
break;
}