fix(tracking): fire begin_checkout when onboarding checkout starts - #170
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
trackBeginCheckout()(emresources/js/composables/useTracking.ts) estava definido mas nunca era chamado — código morto. Por isso os eventosbegin_checkout(GTM/dataLayer) echeckout.started(PostHog) nunca disparavam, deixando um buraco no funil entresign_upepurchase.A única tela que inicia checkout,
onboarding/Connect.vue, faziaform.post(checkout.url())direto pro Stripe sem disparar tracking.Correção
OnboardingController::connect— passa o plano (name+interval: 'monthly') pra tela. O interval é sempremonthlyporque esse checkout usastripe_monthly_price_id.Connect.vue— importauseTrackinge chamatrackBeginCheckout({ name, interval })nosubmit(), antes doform.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 oProcessing.vue.Teste
Novo caso em
OnboardingControllerTestgarantindo que a telaconnectrecebeplan.nameeplan.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 passedConnect.vue): limpo