Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track Site Features on Step Change #316

Merged
merged 3 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
} 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 @@ -70,7 +71,7 @@
allSteps: select( nfdOnboardingStore ).getAllSteps(),
};
},
[ location.pathname ]

Check warning on line 74 in src/OnboardingSPA/components/App/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useSelect has an unnecessary dependency: 'location.pathname'. Either exclude it or remove the dependency array
);

const [ isRequestPlaced, setIsRequestPlaced ] = useState( false );
Expand Down Expand Up @@ -264,6 +265,22 @@
}
}

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 All @@ -284,7 +301,7 @@
setActiveFlow( onboardingFlow );
setActiveStep( location.pathname );
}
}, [ location.pathname, onboardingFlow ] );

Check warning on line 304 in src/OnboardingSPA/components/App/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'handleConditionalDesignStepsRoutes', 'handlePreviousStepTracking', 'setActiveFlow', 'setActiveStep', and 'syncStoreToDB'. Either include them or remove the dependency array

return (
<Fragment>
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 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 @@

currentData.data.siteFeatures = { ...selectedPluginsCopy };
setCurrentOnboardingData( currentData );
if ( true === choice ) {
trackOnboardingEvent(
new OnboardingEvent( ACTION_FEATURE_ADDED, slug )
);
}
}

async function changeToStoreSchema( customPlugins, saveToStore = false ) {
Expand Down Expand Up @@ -95,7 +85,7 @@
setDrawerActiveView( VIEW_NAV_PRIMARY );
setIsHeaderNavigationEnabled( true );
getCustomPlugins();
}, [] );

Check warning on line 88 in src/OnboardingSPA/steps/SiteFeatures/index.js

View workflow job for this annotation

GitHub Actions / Run Lint Checks

React Hook useEffect has missing dependencies: 'getCustomPlugins', 'isLargeViewport', 'setDrawerActiveView', 'setIsDrawerOpened', 'setIsDrawerSuppressed', 'setIsHeaderNavigationEnabled', and 'setSidebarActiveView'. Either include them or remove the dependency array

const content = getContents();

Expand Down