Skip to content

Commit fe10f0a

Browse files
committed
[dashboard] Report uiExperiments on every event
1 parent 01a5248 commit fe10f0a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/dashboard/src/Analytics.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { getGitpodService } from "./service/service";
88
import { log } from "@gitpod/gitpod-protocol/lib/util/logging";
99
import Cookies from "js-cookie";
1010
import { v4 } from "uuid";
11+
import { Experiment } from "./experiments";
1112

1213

1314
export type Event = "invite_url_requested" | "organisation_authorised";
@@ -17,7 +18,7 @@ export type EventProperties =
1718
TrackOrgAuthorised
1819
| TrackInviteUrlRequested
1920
;
20-
type InternalEventProperties = (
21+
type InternalEventProperties = TrackUIExperiments & (
2122
EventProperties
2223
| TrackDashboardClick
2324
| TrackPathChanged
@@ -45,12 +46,18 @@ interface TrackPathChanged {
4546
path: string,
4647
}
4748

49+
interface TrackUIExperiments {
50+
ui_experiments?: string[],
51+
}
52+
4853
//call this to track all events outside of button and anchor clicks
4954
export const trackEvent = (event: Event, properties: EventProperties) => {
5055
trackEventInternal(event, properties);
5156
}
5257

5358
const trackEventInternal = (event: InternalEvent, properties: InternalEventProperties, userKnown?: boolean) => {
59+
properties.ui_experiments = Experiment.getAsArray();
60+
5461
getGitpodService().server.trackEvent({
5562
//if the user is authenticated, let server determine the id. else, pass anonymousId explicitly.
5663
anonymousId: userKnown ? undefined : getAnonymousId(),
@@ -121,7 +128,7 @@ export const trackPathChange = (props: TrackPathChanged) => {
121128
}
122129

123130

124-
type TrackLocationProperties = {
131+
type TrackLocationProperties = TrackUIExperiments & {
125132
referrer: string,
126133
path: string,
127134
host: string,
@@ -134,6 +141,7 @@ export const trackLocation = async (userKnown: boolean) => {
134141
path: window.location.pathname,
135142
host: window.location.hostname,
136143
url: window.location.href,
144+
ui_experiments: Experiment.getAsArray(),
137145
};
138146

139147
getGitpodService().server.trackLocation({

0 commit comments

Comments
 (0)