From ab010ae25cce325ee5f8adca33dc94c17d2b5bc2 Mon Sep 17 00:00:00 2001 From: Josh Dover <1813008+joshdover@users.noreply.github.com> Date: Mon, 19 Jul 2021 17:13:01 +0200 Subject: [PATCH] Fix bug where loaded event is not sent when no user ID (#106090) --- x-pack/plugins/cloud/public/fullstory.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/cloud/public/fullstory.ts b/x-pack/plugins/cloud/public/fullstory.ts index b118688f31ae..a5b735bce938 100644 --- a/x-pack/plugins/cloud/public/fullstory.ts +++ b/x-pack/plugins/cloud/public/fullstory.ts @@ -78,10 +78,11 @@ export const initializeFullStory = async ({ try { // This needs to be called syncronously to be sure that we populate the user ID soon enough to make sessions merging // across domains work - if (!userId) return; - // Do the hashing here to keep it at clear as possible in our source code that we do not send literal user IDs - const hashedId = sha256(userId.toString()); - fullStory.identify(hashedId); + if (userId) { + // Do the hashing here to keep it at clear as possible in our source code that we do not send literal user IDs + const hashedId = sha256(userId.toString()); + fullStory.identify(hashedId); + } } catch (e) { // eslint-disable-next-line no-console console.error(`[cloud.full_story] Could not call FS.identify due to error: ${e.toString()}`, e);