diff --git a/src/progressive-profiling/ProgressiveProfiling.jsx b/src/progressive-profiling/ProgressiveProfiling.jsx index 8fa31a88..28ff4a01 100644 --- a/src/progressive-profiling/ProgressiveProfiling.jsx +++ b/src/progressive-profiling/ProgressiveProfiling.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import { getConfig, snakeCaseObject } from '@edx/frontend-platform'; -import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; +import { identifyAuthenticatedUser, sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics'; import { AxiosJwtAuthService, configure as configureAuth, @@ -64,9 +64,10 @@ const ProgressiveProfiling = (props) => { if (registrationResponse) { setRegistrationResult(registrationResponse); + identifyAuthenticatedUser(authenticatedUser?.userId); sendPageEvent('login_and_registration', 'welcome'); } - }, [DASHBOARD_URL, registrationResponse]); + }, [authenticatedUser, DASHBOARD_URL, registrationResponse]); useEffect(() => { if (registrationResponse) { diff --git a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx index f5c51096..70ed0505 100644 --- a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx +++ b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx @@ -27,6 +27,7 @@ jest.mock('@edx/frontend-platform/logging'); analytics.sendTrackEvent = jest.fn(); analytics.sendPageEvent = jest.fn(); +analytics.identifyAuthenticatedUser = jest.fn(); logging.getLoggingService = jest.fn(); auth.configure = jest.fn(); @@ -127,6 +128,11 @@ describe('ProgressiveProfilingTests', () => { expect(progressiveProfilingPage.find('#gender').exists()).toBeTruthy(); }); + it('should make identify call to segment on progressive profiling page', async () => { + await getProgressiveProfilingPage(); + expect(analytics.identifyAuthenticatedUser).toHaveBeenCalled(); + }); + it('should submit user profile details on form submission', async () => { auth.getAuthenticatedUser = jest.fn(() => ({ userId: 3, username: 'abc123' })); const formPayload = {