Skip to main content

Overview

The TrackForm component automatically tracks form submissions and optionally tracks individual field changes. It wraps your form and provides analytics on user interactions with form fields.

Props

ReactNode
required
The form fields and content to render inside the form element.
string
required
A unique identifier for the form. Used to distinguish between different forms in your analytics.
boolean
default:true
Whether to track form submissions. When enabled, tracks a form_submitted event with form details.
boolean
default:false
Whether to track individual field changes. When enabled, tracks a form_field_changed event for each field interaction.

Usage

Basic Form Tracking

Track Field Changes

Multi-Step Form

Tracked Events

form_submitted

Tracked when the form is submitted (if trackSubmit is true):

form_field_changed

Tracked when a field value changes (if trackFieldChanges is true):

Behavior

  • Renders as a native <form> element
  • Captures form submission events and extracts field data
  • Tracks all fields with a name attribute
  • Does not prevent default form submission behavior
  • Field change tracking only works for fields with a name attribute
  • Automatically extracts form data using FormData API

Use Cases

  • Track form completion rates
  • Identify problematic form fields
  • Measure user engagement with forms
  • A/B test form designs
  • Monitor field interaction patterns
  • Analyze form abandonment