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

Adds the site's goals to the launchpad tracks events #99464

Merged
merged 1 commit into from
Feb 9, 2025
Merged
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
4 changes: 4 additions & 0 deletions packages/launchpad/src/use-tracking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const useTracking = ( params: Params ) => {
const isCheckListCompleted = completedSteps.length === tasks.length;
const isSiteAvailable = !! site;
const hasNoTask = tasks.length === 0;
const goals = site?.options?.site_goals?.join( ',' );

// We skip the view events until we have fetched the site details to avoid sending incomplete data
const shoulSkipTracking = hasNoTask || ! isSiteAvailable;
Expand All @@ -49,6 +50,7 @@ export const useTracking = ( params: Params ) => {
context: context,
site_intent: siteIntent,
flow,
goals,
} );

tasks.forEach( ( task: Task ) => {
Expand All @@ -60,6 +62,7 @@ export const useTracking = ( params: Params ) => {
order: task.order,
site_intent: siteIntent,
flow,
goals,
} );
} );
// Array of tasks requires deep comparison
Expand All @@ -78,6 +81,7 @@ export const useTracking = ( params: Params ) => {
task_id: task.id,
flow,
order: task.order,
goals,
} );
};

Expand Down
Loading