diff --git a/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts b/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts index 4c6674bc45..0e1cb4b01a 100644 --- a/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts +++ b/packages/analytics-js-plugins/__tests__/bugsnag/index.test.ts @@ -22,6 +22,14 @@ describe('Plugin - Bugsnag', () => { installType: 'npm', }), }, + session: { + sessionInfo: signal({ id: 'test-session-id' }), + }, + autoTrack: { + pageLifecycle: { + visitId: signal('test-visit-id'), + }, + }, }; let state: any; diff --git a/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts b/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts index 6d58890430..4891ede13c 100644 --- a/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts +++ b/packages/analytics-js-plugins/__tests__/bugsnag/utils.test.ts @@ -40,6 +40,14 @@ beforeEach(() => { lifecycle: { writeKey: signal('dummy-write-key'), }, + session: { + sessionInfo: signal({ id: 'test-session-id' }), + }, + autoTrack: { + pageLifecycle: { + visitId: signal('test-visit-id'), + }, + }, }; }); @@ -235,6 +243,14 @@ describe('Bugsnag utilities', () => { installType: 'npm', }, }, + session: { + sessionInfo: { id: 'test-session-id' }, + }, + autoTrack: { + pageLifecycle: { + visitId: 'test-visit-id', + }, + }, }, }); @@ -277,6 +293,14 @@ describe('Bugsnag utilities', () => { installType: 'npm', }, }, + session: { + sessionInfo: { id: 'test-session-id' }, + }, + autoTrack: { + pageLifecycle: { + visitId: 'test-visit-id', + }, + }, }, }); @@ -338,7 +362,7 @@ describe('Bugsnag utilities', () => { maxBreadcrumbs: 40, releaseStage: 'development', user: { - id: 'dummy-source-id', + id: 'dummy-source-id..test-session-id..test-visit-id', }, networkBreadcrumbsEnabled: false, beforeSend: expect.any(Function), @@ -377,7 +401,7 @@ describe('Bugsnag utilities', () => { maxBreadcrumbs: 40, releaseStage: 'development', user: { - id: 'dummy-write-key', + id: 'dummy-write-key..test-session-id..test-visit-id', }, networkBreadcrumbsEnabled: false, beforeSend: expect.any(Function), @@ -527,6 +551,14 @@ describe('Bugsnag utilities', () => { installType: 'npm', }, }, + session: { + sessionInfo: { id: 'test-session-id' }, + }, + autoTrack: { + pageLifecycle: { + visitId: 'test-visit-id', + }, + }, }); expect(error.severity).toBe('error'); expect(error.context).toBe('Script load failures'); diff --git a/packages/analytics-js-plugins/__tests__/errorReporting/utils.test.ts b/packages/analytics-js-plugins/__tests__/errorReporting/utils.test.ts index df05b806d1..eee1c438e6 100644 --- a/packages/analytics-js-plugins/__tests__/errorReporting/utils.test.ts +++ b/packages/analytics-js-plugins/__tests__/errorReporting/utils.test.ts @@ -416,7 +416,7 @@ describe('Error Reporting utilities', () => { }, }, user: { - id: 'sample_source_id - test-session-id - test-visit-id', + id: 'sample_source_id..test-session-id..test-visit-id', }, }, ], diff --git a/packages/analytics-js-plugins/src/bugsnag/utils.ts b/packages/analytics-js-plugins/src/bugsnag/utils.ts index 135054ef83..e1c159dcae 100644 --- a/packages/analytics-js-plugins/src/bugsnag/utils.ts +++ b/packages/analytics-js-plugins/src/bugsnag/utils.ts @@ -136,7 +136,8 @@ const getNewClient = (state: ApplicationState, logger?: ILogger): BugsnagLib.Cli maxBreadcrumbs: 40, releaseStage: getReleaseStage(), user: { - id: state.source.value?.id || state.lifecycle.writeKey.value, + // Combination of source, session and visit ids + id: `${state.source.value?.id ?? (state.lifecycle.writeKey.value as string)}..${state.session.sessionInfo.value?.id ?? 'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value ?? 'NA'}`, }, logger, networkBreadcrumbsEnabled: false, diff --git a/packages/analytics-js-plugins/src/errorReporting/utils.ts b/packages/analytics-js-plugins/src/errorReporting/utils.ts index fb40b8b09a..ef8fadc3bc 100644 --- a/packages/analytics-js-plugins/src/errorReporting/utils.ts +++ b/packages/analytics-js-plugins/src/errorReporting/utils.ts @@ -133,7 +133,7 @@ const getBugsnagErrorEvent = ( }, user: { // Combination of source, session and visit ids - id: `${state.source.value?.id ?? (state.lifecycle.writeKey.value as string)} - ${state.session.sessionInfo.value?.id ?? 'NA'} - ${state.autoTrack.pageLifecycle.visitId.value ?? 'NA'}`, + id: `${state.source.value?.id ?? (state.lifecycle.writeKey.value as string)}..${state.session.sessionInfo.value?.id ?? 'NA'}..${state.autoTrack?.pageLifecycle?.visitId?.value ?? 'NA'}`, }, }, ], diff --git a/packages/analytics-js/.size-limit.mjs b/packages/analytics-js/.size-limit.mjs index d55635d440..82b89e09dc 100644 --- a/packages/analytics-js/.size-limit.mjs +++ b/packages/analytics-js/.size-limit.mjs @@ -13,7 +13,7 @@ export default [ name: 'Core - Legacy - NPM (CJS)', path: 'dist/npm/legacy/cjs/index.cjs', import: '*', - limit: '49 KiB', + limit: '49.1 KiB', }, { name: 'Core - Legacy - NPM (UMD)',