From 8dd0722e04bfb20074fc8083227ba7671cda3078 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 1 Feb 2022 15:49:49 +0000 Subject: [PATCH] Update eventName=Screen to $screen to match PostHog's special behaviour (#7667) --- package.json | 2 +- scripts/ci/install-deps.sh | 10 ++++++++-- scripts/ci/layered.sh | 8 ++++++++ src/components/structures/MatrixChat.tsx | 14 +++++++------- yarn.lock | 4 ++-- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b94851503e..c0aeb0ecc2 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "katex": "^0.12.0", "lodash": "^4.17.20", "maplibre-gl": "^1.15.2", - "matrix-analytics-events": "github:matrix-org/matrix-analytics-events.git#1eab4356548c97722a183912fda1ceabbe8cc7c1", + "matrix-analytics-events": "github:matrix-org/matrix-analytics-events.git#dfa6feaa12bcfc8e99b05a148e12fff7f9d62f08", "matrix-events-sdk": "^0.0.1-beta.6", "matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop", "matrix-widget-api": "^0.1.0-beta.18", diff --git a/scripts/ci/install-deps.sh b/scripts/ci/install-deps.sh index fcbf6b1198..0741ad2ab3 100755 --- a/scripts/ci/install-deps.sh +++ b/scripts/ci/install-deps.sh @@ -3,11 +3,17 @@ set -ex scripts/fetchdep.sh matrix-org matrix-js-sdk - pushd matrix-js-sdk yarn link yarn install --pure-lockfile $@ popd -yarn link matrix-js-sdk +scripts/fetchdep.sh matrix-org matrix-analytics-events main +pushd matrix-analytics-events +yarn link +yarn install --pure-lockfile $@ +popd + +yarn link matrix-js-sdk +yarn link matrix-analytics-events yarn install --pure-lockfile $@ diff --git a/scripts/ci/layered.sh b/scripts/ci/layered.sh index 2e163456fe..3e30cc808f 100755 --- a/scripts/ci/layered.sh +++ b/scripts/ci/layered.sh @@ -16,8 +16,16 @@ yarn link yarn install --pure-lockfile popd +# Set up the js-sdk first +scripts/fetchdep.sh matrix-org matrix-analytics-events main +pushd matrix-analytics-events +yarn link +yarn install --pure-lockfile +popd + # Now set up the react-sdk yarn link matrix-js-sdk +yarn link matrix-analytics-events yarn link yarn install --pure-lockfile yarn reskindex diff --git a/src/components/structures/MatrixChat.tsx b/src/components/structures/MatrixChat.tsx index e6b10aaea8..aff854b149 100644 --- a/src/components/structures/MatrixChat.tsx +++ b/src/components/structures/MatrixChat.tsx @@ -472,17 +472,17 @@ export default class MatrixChat extends React.PureComponent { } public trackScreenChange(durationMs: number): void { - const notLoggedInMap = {}; + const notLoggedInMap: Partial> = {}; notLoggedInMap[Views.LOADING] = "WebLoading"; - notLoggedInMap[Views.WELCOME] = "WebWelcome"; - notLoggedInMap[Views.LOGIN] = "WebLogin"; - notLoggedInMap[Views.REGISTER] = "WebRegister"; - notLoggedInMap[Views.FORGOT_PASSWORD] = "WebForgotPassword"; + notLoggedInMap[Views.WELCOME] = "Welcome"; + notLoggedInMap[Views.LOGIN] = "Login"; + notLoggedInMap[Views.REGISTER] = "Register"; + notLoggedInMap[Views.FORGOT_PASSWORD] = "ForgotPassword"; notLoggedInMap[Views.COMPLETE_SECURITY] = "WebCompleteSecurity"; notLoggedInMap[Views.E2E_SETUP] = "WebE2ESetup"; notLoggedInMap[Views.SOFT_LOGOUT] = "WebSoftLogout"; - const loggedInPageTypeMap = {}; + const loggedInPageTypeMap: Partial> = {}; loggedInPageTypeMap[PageType.HomePage] = "Home"; loggedInPageTypeMap[PageType.RoomView] = "Room"; loggedInPageTypeMap[PageType.RoomDirectory] = "RoomDirectory"; @@ -495,7 +495,7 @@ export default class MatrixChat extends React.PureComponent { notLoggedInMap[this.state.view]; return PosthogAnalytics.instance.trackEvent({ - eventName: "Screen", + eventName: "$screen", screenName, durationMs, }); diff --git a/yarn.lock b/yarn.lock index f4f63729a7..cf3b9a1aae 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6214,9 +6214,9 @@ mathml-tag-names@^2.1.3: resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3" integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg== -"matrix-analytics-events@github:matrix-org/matrix-analytics-events.git#1eab4356548c97722a183912fda1ceabbe8cc7c1": +"matrix-analytics-events@github:matrix-org/matrix-analytics-events.git#dfa6feaa12bcfc8e99b05a148e12fff7f9d62f08": version "0.0.1" - resolved "https://codeload.github.com/matrix-org/matrix-analytics-events/tar.gz/1eab4356548c97722a183912fda1ceabbe8cc7c1" + resolved "https://codeload.github.com/matrix-org/matrix-analytics-events/tar.gz/dfa6feaa12bcfc8e99b05a148e12fff7f9d62f08" matrix-events-sdk@^0.0.1-beta.6: version "0.0.1-beta.6"