diff --git a/x-pack/plugins/cloud/public/plugin.test.ts b/x-pack/plugins/cloud/public/plugin.test.ts index 4f81dd5f0cdc1..74b88cfe00081 100644 --- a/x-pack/plugins/cloud/public/plugin.test.ts +++ b/x-pack/plugins/cloud/public/plugin.test.ts @@ -103,6 +103,8 @@ describe('Cloud Plugin', () => { version_patch_int: -1, } ); + + expect(fullStoryApiMock.setUserVars).toHaveBeenCalledWith({ org_id_str: 'cloudId' }); }); it('user hash includes org id', async () => { @@ -147,7 +149,6 @@ describe('Cloud Plugin', () => { expect(fullStoryApiMock.setVars).toHaveBeenCalledWith('page', { pageName: 'App1', app_id_str: 'App1', - org_id_str: 'cloudId', }); // context clear @@ -155,7 +156,6 @@ describe('Cloud Plugin', () => { expect(fullStoryApiMock.setVars).toHaveBeenCalledWith('page', { pageName: 'App1', app_id_str: 'App1', - org_id_str: 'cloudId', }); // different app @@ -169,7 +169,6 @@ describe('Cloud Plugin', () => { app_id_str: 'App2', page_str: 'page2', ent_id_str: '123', - org_id_str: 'cloudId', }); // Back to first app @@ -184,7 +183,6 @@ describe('Cloud Plugin', () => { app_id_str: 'App1', page_str: 'page3', ent_id_str: '123', - org_id_str: 'cloudId', }); expect(currentContext$.observers.length).toBe(1); diff --git a/x-pack/plugins/cloud/public/plugin.tsx b/x-pack/plugins/cloud/public/plugin.tsx index a0822da8901c9..1b7539bd7fa95 100644 --- a/x-pack/plugins/cloud/public/plugin.tsx +++ b/x-pack/plugins/cloud/public/plugin.tsx @@ -259,6 +259,10 @@ export class CloudPlugin implements Plugin { packageInfo: this.initializerContext.env.packageInfo, }); + fullStory.setUserVars({ + org_id_str: esOrgId, + }); + // Very defensive try/catch to avoid any UnhandledPromiseRejections try { // This needs to be called syncronously to be sure that we populate the user ID soon enough to make sessions merging @@ -283,7 +287,6 @@ export class CloudPlugin implements Plugin { app_id_str: name ?? 'unknown', page_str: page, ent_id_str: id, - org_id_str: esOrgId, }, isUndefined )