@@ -8,6 +8,7 @@ import { getGitpodService } from "./service/service";
8
8
import { log } from "@gitpod/gitpod-protocol/lib/util/logging" ;
9
9
import Cookies from "js-cookie" ;
10
10
import { v4 } from "uuid" ;
11
+ import { Experiment } from "./experiments" ;
11
12
12
13
13
14
export type Event = "invite_url_requested" | "organisation_authorised" ;
@@ -17,7 +18,7 @@ export type EventProperties =
17
18
TrackOrgAuthorised
18
19
| TrackInviteUrlRequested
19
20
;
20
- type InternalEventProperties = (
21
+ type InternalEventProperties = TrackUIExperiments & (
21
22
EventProperties
22
23
| TrackDashboardClick
23
24
| TrackPathChanged
@@ -45,12 +46,18 @@ interface TrackPathChanged {
45
46
path : string ,
46
47
}
47
48
49
+ interface TrackUIExperiments {
50
+ ui_experiments ?: string [ ] ,
51
+ }
52
+
48
53
//call this to track all events outside of button and anchor clicks
49
54
export const trackEvent = ( event : Event , properties : EventProperties ) => {
50
55
trackEventInternal ( event , properties ) ;
51
56
}
52
57
53
58
const trackEventInternal = ( event : InternalEvent , properties : InternalEventProperties , userKnown ?: boolean ) => {
59
+ properties . ui_experiments = Experiment . getAsArray ( ) ;
60
+
54
61
getGitpodService ( ) . server . trackEvent ( {
55
62
//if the user is authenticated, let server determine the id. else, pass anonymousId explicitly.
56
63
anonymousId : userKnown ? undefined : getAnonymousId ( ) ,
@@ -121,7 +128,7 @@ export const trackPathChange = (props: TrackPathChanged) => {
121
128
}
122
129
123
130
124
- type TrackLocationProperties = {
131
+ type TrackLocationProperties = TrackUIExperiments & {
125
132
referrer : string ,
126
133
path : string ,
127
134
host : string ,
@@ -134,6 +141,7 @@ export const trackLocation = async (userKnown: boolean) => {
134
141
path : window . location . pathname ,
135
142
host : window . location . hostname ,
136
143
url : window . location . href ,
144
+ ui_experiments : Experiment . getAsArray ( ) ,
137
145
} ;
138
146
139
147
getGitpodService ( ) . server . trackLocation ( {
0 commit comments