diff --git a/src/OnboardingSPA/components/App/index.js b/src/OnboardingSPA/components/App/index.js index a93f7d57c..a2c7d7ab4 100644 --- a/src/OnboardingSPA/components/App/index.js +++ b/src/OnboardingSPA/components/App/index.js @@ -26,6 +26,7 @@ import { } from '../../utils/analytics/hiive'; import { injectInAllSteps } from '../../data/flows/utils'; import { + ACTION_FEATURE_ADDED, ACTION_LOGO_ADDED, ACTION_SITE_TITLE_SET, ACTION_SOCIAL_ADDED, @@ -264,6 +265,22 @@ const App = () => { } } + if ( previousStepPath.includes( 'site-features' ) ) { + const siteFeatures = currentData.data.siteFeatures; + for ( const siteFeature in siteFeatures ) { + if ( false !== siteFeatures[ siteFeature ] ) { + trackOnboardingEvent( + new OnboardingEvent( + ACTION_FEATURE_ADDED, + siteFeature, + {}, + previousStepURL + ) + ); + } + } + } + window.nfdOnboarding.previousStep = { path: location.pathname, url: window.location.href, diff --git a/src/OnboardingSPA/steps/SiteFeatures/index.js b/src/OnboardingSPA/steps/SiteFeatures/index.js index 2bf116ae1..0bb792eef 100644 --- a/src/OnboardingSPA/steps/SiteFeatures/index.js +++ b/src/OnboardingSPA/steps/SiteFeatures/index.js @@ -12,11 +12,6 @@ import HeadingWithSubHeading from '../../components/HeadingWithSubHeading'; import CheckboxList from '../../components/CheckboxTemplate/CheckboxList'; import { CheckboxListSkeleton } from '../../components/CheckboxTemplate'; import getContents from './contents'; -import { - OnboardingEvent, - trackOnboardingEvent, -} from '../../utils/analytics/hiive'; -import { ACTION_FEATURE_ADDED } from '../../utils/analytics/hiive/constants'; const StepSiteFeatures = () => { const isLargeViewport = useViewportMatch( 'medium' ); @@ -53,11 +48,6 @@ const StepSiteFeatures = () => { currentData.data.siteFeatures = { ...selectedPluginsCopy }; setCurrentOnboardingData( currentData ); - if ( true === choice ) { - trackOnboardingEvent( - new OnboardingEvent( ACTION_FEATURE_ADDED, slug ) - ); - } } async function changeToStoreSchema( customPlugins, saveToStore = false ) {