Skip to content

Commit 1d74961

Browse files
committed
Update Migration Event Tracking
1 parent 6135230 commit 1d74961

File tree

1 file changed

+15
-8
lines changed
  • src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild

1 file changed

+15
-8
lines changed

src/OnboardingSPA/components/NewfoldInterfaceSkeleton/SiteBuild/index.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { useEffect, useState } from '@wordpress/element';
33
import { useViewportMatch } from '@wordpress/compose';
44
import { useDispatch, useSelect } from '@wordpress/data';
5+
import apiFetch from '@wordpress/api-fetch';
56

67
// Third part
78
import classNames from 'classnames';
@@ -52,6 +53,7 @@ import {
5253
sendOnboardingEvent,
5354
} from '../../../utils/analytics/hiive';
5455
import { injectInAllSteps } from '../../../data/flows/utils';
56+
import { migrateRestURL } from '../../../utils/api/common';
5557
import {
5658
ACTION_ONBOARDING_CHAPTER_COMPLETE,
5759
ACTION_ONBOARDING_CHAPTER_STARTED,
@@ -389,16 +391,21 @@ const SiteBuild = () => {
389391
const trackInstaWpMigrationEvent = () => {
390392
if ( currentStep?.path === stepSiteGenMigration?.path ) {
391393
if ( instaWpMigrationUrl ) {
392-
getWPSettings().then( ( res ) =>
393-
sendOnboardingEvent(
394-
new OnboardingEvent(
395-
res.nfd_migrate_site
394+
getWPSettings().then( ( res ) => {
395+
apiFetch( {
396+
url: migrateRestURL( 'migrate/events' ),
397+
method: 'POST',
398+
data: {
399+
key: res.nfd_migrate_site
396400
? ACTION_MFE_MIGRATION_INITIATED
397401
: ACTION_MIGRATION_INITIATED,
398-
instaWpMigrationUrl
399-
)
400-
)
401-
);
402+
data: {
403+
path: instaWpMigrationUrl,
404+
page: window.location.href,
405+
},
406+
},
407+
} );
408+
} );
402409
}
403410
}
404411
};

0 commit comments

Comments
 (0)