Skip to content

Commit 1812376

Browse files
committed
adds name to profile_changed and identify calls
1 parent c7229fd commit 1812376

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

components/server/src/workspace/gitpod-server-impl.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
422422
await this.guardAccess({ kind: "user", subject: user }, "update");
423423

424424
//hang on to user profile before it's overwritten for analytics below
425-
const oldProfile = { ...user.additionalData?.profile };
425+
const oldProfile = { name: user.fullName, ...user.additionalData?.profile };
426426

427427
const allowedFields: (keyof User)[] = ["avatarUrl", "fullName", "additionalData"];
428428
for (const p of allowedFields) {
@@ -434,12 +434,13 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
434434
await this.userDB.updateUserPartial(user);
435435

436436
//track event and user profile if profile of partialUser changed
437-
const newProfile = partialUser.additionalData?.profile;
437+
const newProfile = { name: partialUser.fullName, ...partialUser.additionalData?.profile };
438438
if (newProfile) {
439439
if (
440440
!oldProfile ||
441441
newProfile.emailAddress != oldProfile.emailAddress ||
442-
newProfile.companyName != oldProfile.companyName
442+
newProfile.companyName != oldProfile.companyName ||
443+
newProfile.name != oldProfile.name
443444
) {
444445
this.analytics.track({
445446
userId: user.id,
@@ -448,7 +449,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
448449
});
449450
this.analytics.identify({
450451
userId: user.id,
451-
traits: { email: newProfile.emailAddress, company: newProfile.companyName },
452+
traits: { email: newProfile.emailAddress, company: newProfile.companyName, name: newProfile.name },
452453
});
453454
}
454455
}

0 commit comments

Comments
 (0)