From f8f6d263ad4541365aeefdcb9c8ae27acfb76eac Mon Sep 17 00:00:00 2001 From: Paulo Castellano Date: Thu, 25 Jun 2026 21:06:27 -0300 Subject: [PATCH] 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. --- .../Controllers/App/OnboardingController.php | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/App/OnboardingController.php b/app/Http/Controllers/App/OnboardingController.php index 1acb2c7e..80475a77 100644 --- a/app/Http/Controllers/App/OnboardingController.php +++ b/app/Http/Controllers/App/OnboardingController.php @@ -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 $goals - * @return array - */ - 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; - } }