Skip to content

fix(tracking): fire begin_checkout when onboarding checkout starts - #170

Merged
paulocastellano merged 1 commit into
mainfrom
fix/begin-checkout-tracking
Jul 2, 2026
Merged

fix(tracking): fire begin_checkout when onboarding checkout starts#170
paulocastellano merged 1 commit into
mainfrom
fix/begin-checkout-tracking

Conversation

@paulocastellano

Copy link
Copy Markdown
Contributor

Problema

trackBeginCheckout() (em resources/js/composables/useTracking.ts) estava definido mas nunca era chamado — código morto. Por isso os eventos begin_checkout (GTM/dataLayer) e checkout.started (PostHog) nunca disparavam, deixando um buraco no funil entre sign_up e purchase.

A única tela que inicia checkout, onboarding/Connect.vue, fazia form.post(checkout.url()) direto pro Stripe sem disparar tracking.

Correção

  • OnboardingController::connect — passa o plano (name + interval: 'monthly') pra tela. O interval é sempre monthly porque esse checkout usa stripe_monthly_price_id.
  • Connect.vue — importa useTracking e chama trackBeginCheckout({ name, interval }) no submit(), antes do form.post().

O redirect pro Stripe é um Inertia::location, que só acontece depois do round-trip que cria a sessão no Stripe. Esse gap serve de buffer natural pro beacon do PostHog/GTM sair antes da navegação — sem precisar de timer artificial como o Processing.vue.

Teste

Novo caso em OnboardingControllerTest garantindo que a tela connect recebe plan.name e plan.interval. O projeto não tem runner de teste JS, então essa é a cobertura programática cabível para a mudança.

  • php artisan test (onboarding): 34 passed
  • Pint: passed · ESLint (Connect.vue): limpo

trackBeginCheckout was defined but never called, so the begin_checkout
(GTM/dataLayer) and checkout.started (PostHog) events never fired. Wire
it into the onboarding Connect submit handler, before the redirect to
Stripe, and pass the workspace plan from the controller so the event
carries plan name + interval.
@paulocastellano
paulocastellano merged commit b566daf into main Jul 2, 2026
2 checks passed
@paulocastellano
paulocastellano deleted the fix/begin-checkout-tracking branch July 2, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant