Skip to main content

Why track form submissions?

Forms are the most critical moments in any app:
  • A signup form = a new user
  • A checkout form = revenue
  • A contact form = a lead
If users are starting your signup form but not finishing it, you’ll only know that by tracking both when the form opens and when it submits successfully.

The form submission pattern

There are two moments you want to track:
  1. When the user starts filling the form (optional but valuable)
  2. When the form submits successfully
components/Forms.js

React — Signup form example

components/SignupForm.jsx

Login form example

components/LoginForm.jsx

Contact / enquiry form example

components/ContactForm.jsx

Checkout / payment form example

components/CheckoutForm.jsx

Key rule: Don’t track the ‘Submit’ button directly!

It is very tempting to just add track() to the final submit button. Do not do this. If you track the button click, your dashboard will show a “Signup” or “Purchase” even if the user’s credit card was declined or they typed the wrong password. You will get fake data. Always add your tracking code after your database or payment system confirms it was successful:
api/users.js