Skip to content

Commit 9880270

Browse files
jakobheroroboquat
authored andcommitted
Only push events of authenticated users to Mixpanel
1 parent 03fcf80 commit 9880270

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

components/gitpod-protocol/src/util/analytics.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ class SegmentAnalyticsWriter implements IAnalyticsWriter {
3030

3131
identify(msg: IdentifyMessage) {
3232
try {
33-
this.analytics.identify(msg, (err: Error) => {
33+
this.analytics.identify({
34+
...msg,
35+
integrations: {
36+
"All": true,
37+
"Mixpanel": !!msg.userId
38+
}
39+
}, (err: Error) => {
3440
if (err) {
3541
log.warn("analytics.identify failed", err);
3642
}
@@ -42,7 +48,13 @@ class SegmentAnalyticsWriter implements IAnalyticsWriter {
4248

4349
track(msg: TrackMessage) {
4450
try {
45-
this.analytics.track(msg, (err: Error) => {
51+
this.analytics.track({
52+
...msg,
53+
integrations: {
54+
"All": true,
55+
"Mixpanel": !!msg.userId
56+
}
57+
}, (err: Error) => {
4658
if (err) {
4759
log.warn("analytics.track failed", err);
4860
}
@@ -54,7 +66,13 @@ class SegmentAnalyticsWriter implements IAnalyticsWriter {
5466

5567
page(msg: PageMessage) {
5668
try{
57-
this.analytics.page(msg, (err: Error) => {
69+
this.analytics.page({
70+
...msg,
71+
integrations: {
72+
"All": true,
73+
"Mixpanel": !!msg.userId
74+
}
75+
}, (err: Error) => {
5876
if (err) {
5977
log.warn("analytics.page failed", err);
6078
}

0 commit comments

Comments
 (0)