refactor(onboarding): send goals to PostHog exactly like persona
Mirror the persona handling: identify the user with a single `goals` person property instead of an array plus a boolean per goal. Drops the goalProperties helper.
This commit is contained in:
parent
2525d834b0
commit
f8f6d263ad
1 changed files with 3 additions and 19 deletions
|
|
@ -106,7 +106,9 @@ public function storeGoals(StoreOnboardingGoalsRequest $request, PostHogService
|
|||
|
||||
$user->update(['goals' => $goals]);
|
||||
|
||||
$postHog->identify($user->id, $this->goalProperties($goals));
|
||||
$postHog->identify($user->id, [
|
||||
'goals' => $goals,
|
||||
]);
|
||||
|
||||
return redirect()->route('app.onboarding.connect');
|
||||
}
|
||||
|
|
@ -183,22 +185,4 @@ public function checkout(Request $request, StartSubscriptionCheckout $checkout):
|
|||
route('app.onboarding.connect'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* PostHog person properties for the selected goals: the full array plus a
|
||||
* boolean per goal, so campaigns can be cross-tabbed against each intent.
|
||||
*
|
||||
* @param array<int, string> $goals
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function goalProperties(array $goals): array
|
||||
{
|
||||
$properties = ['onboarding_goals' => $goals];
|
||||
|
||||
foreach (Goal::cases() as $goal) {
|
||||
$properties["goal_{$goal->value}"] = in_array($goal->value, $goals, true);
|
||||
}
|
||||
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue