Skip to content

Commit

Permalink
Merge pull request #316 from newfold-labs/enhance/feature-added
Browse files Browse the repository at this point in the history
Track Site Features on Step Change
  • Loading branch information
arunshenoy99 authored Sep 28, 2023
2 parents 6360509 + 2f2b29e commit 7a0038b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
17 changes: 17 additions & 0 deletions src/OnboardingSPA/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions src/OnboardingSPA/steps/SiteFeatures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 7a0038b

Please sign in to comment.