diff --git a/services/web/app/src/Features/Analytics/AnalyticsManager.js b/services/web/app/src/Features/Analytics/AnalyticsManager.js index ed2328fd7e..220813eb4a 100644 --- a/services/web/app/src/Features/Analytics/AnalyticsManager.js +++ b/services/web/app/src/Features/Analytics/AnalyticsManager.js @@ -15,7 +15,7 @@ const analyticsUserPropertiesQueue = Queues.getAnalyticsUserPropertiesQueue() const ONE_MINUTE_MS = 60 * 1000 function identifyUser(userId, analyticsId, isNewUser) { - if (!userId || !analyticsId) { + if (!userId || !analyticsId || userId === analyticsId) { return } if (_isAnalyticsDisabled() || _isSmokeTestUser(userId)) { diff --git a/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js b/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js index 8e4c91601f..29dfa0d8ee 100644 --- a/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js +++ b/services/web/test/unit/src/Analytics/AnalyticsManagerTests.js @@ -70,6 +70,16 @@ describe('AnalyticsManager', function () { this.AnalyticsManager.identifyUser(this.fakeUserId, '') sinon.assert.notCalled(this.analyticsEventsQueue.add) }) + + it('userId or analyticsId is missing', function () { + this.AnalyticsManager.identifyUser(this.fakeUserId, undefined) + sinon.assert.notCalled(this.analyticsEventsQueue.add) + }) + + it('userId equal analyticsId', function () { + this.AnalyticsManager.identifyUser(this.fakeUserId, this.fakeUserId) + sinon.assert.notCalled(this.analyticsEventsQueue.add) + }) }) describe('queues the appropriate message for', function () {