Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Form Analytics provides actionable insights into form usage, completion patterns, and user engagement to help optimize forms and improve completion rates.
Features
Analytics Tracking
- Form Events: Track form starts, completions, and abandonments
- Field Interactions: Monitor focus, changes, and validation errors per field
- Device Tracking: Separate analytics for mobile, tablet, and desktop
- Session Tracking: Group events by user session for funnel analysis
Metrics
- Completion Rate: Percentage of started forms that are completed
- Time to Complete: Median and P95 completion times
- Drop-off Analysis: Identify where users abandon forms
- Field Performance: See which fields cause errors or confusion
Enabling Analytics
Analytics are enabled by default for all new forms. To disable:
- Open Form Builder
- Go to Settings tab
- Toggle “Analytics Enabled” off
Viewing Analytics
Navigate to /fw/analytics to view:
- Overview: Summary cards with key metrics
- Completion Funnel: Visualize where users drop off
- Field Performance: Table showing field-level statistics
- Trends: Chart showing submission volume over time
From the Form Builder, click “View Analytics” to see metrics for a specific form.
Privacy & Security
- No Field Values Logged: Only field keys and interaction types are tracked
- No PII: Personal information is never logged
- Aggregate Reporting: Individual user tracking is not supported
- Opt-Out: Forms can disable analytics entirely
- Data Retention: Raw events are retained for 90 days, aggregates indefinitely
Optimization Tips
Improving Completion Rates
- Identify Drop-off Points: Look for fields with high abandonment rates
- Simplify Complex Fields: If a field has many errors, consider breaking it into simpler components
- Reduce Form Length: Forms with fewer fields generally have higher completion rates
- Optimize Mobile Experience: Check mobile completion rate vs desktop
Reducing Time to Complete
- Remove Unnecessary Fields: Every field adds cognitive load
- Use Defaults: Pre-fill fields when possible
- Add Helper Text: Clear instructions reduce errors and speed completion
- Use Appropriate Input Types: Date pickers are faster than text inputs for dates
Reducing Errors
- Clear Validation Messages: Tell users exactly what’s wrong
- Inline Validation: Validate as users type, not just on submit
- Format Examples: Show expected format (e.g., “MM/DD/YYYY”)
API Reference
import { useFormAnalytics } from '@/platform/forms/hooks/useFormAnalytics';
const analytics = useFormAnalytics(formId, {
enabled: true,
batchSize: 10,
batchInterval: 5000,
});
// Track events
analytics.trackFormStart();
analytics.trackFieldFocus('email');
analytics.trackFieldChange('email', { length: 15 });
analytics.trackValidationError('email', 'Invalid format');
analytics.trackFormComplete(submissionId);
Analytics Functions
Logs a single analytics event.
SELECT log_form_analytics_event(
_form_id := '...',
_event_type := 'form_started',
_session_id := '...',
_field_key := NULL,
_submission_id := NULL,
_event_data := '{}',
_device_type := 'desktop'
);
aggregate_completion_metrics()
Aggregates raw events into daily completion metrics.
SELECT aggregate_completion_metrics('2025-01-27');
aggregate_field_stats()
Aggregates field-level statistics.
SELECT aggregate_field_stats('2025-01-27');
Database Schema
Raw analytics events (pruned after 90 days).
| Column | Type | Description |
|---|
| id | UUID | Event ID |
| form_id | UUID | Form being tracked |
| session_id | UUID | User session |
| event_type | TEXT | Event type (form_started, field_focused, etc.) |
| field_key | TEXT | Field identifier (for field events) |
| event_timestamp | TIMESTAMPTZ | When event occurred |
| device_type | TEXT | mobile/tablet/desktop |
Daily aggregated completion metrics (retained indefinitely).
| Column | Type | Description |
|---|
| form_id | UUID | Form |
| metric_date | DATE | Aggregation date |
| started_count | INT | Forms started |
| completed_count | INT | Forms completed |
| completion_rate | FLOAT | Completion percentage |
| median_time_to_complete_seconds | INT | Median completion time |
pf_field_interaction_stats
Daily aggregated field statistics (retained indefinitely).
| Column | Type | Description |
|---|
| form_id | UUID | Form |
| field_key | TEXT | Field identifier |
| metric_date | DATE | Aggregation date |
| focus_count | INT | Times focused |
| change_count | INT | Times changed |
| error_count | INT | Validation errors |
Troubleshooting
Events Not Appearing
- Check Analytics Enabled: Ensure the form has
analytics_enabled = true
- Verify RLS Policies: User must have access to the form’s organization
- Check Console: Look for errors in browser console
- Aggregation Delay: Raw events are aggregated every 5 minutes
Metrics Don’t Match Submissions
- Metrics are based on sessions, not individual submissions
- A user can start a form multiple times in different sessions
- Completed count may be less than submission count if analytics was disabled
- Analytics use batching (5 second intervals) to minimize impact
- Raw events are automatically pruned after 90 days
- Aggregated metrics use indexed queries for fast access
Best Practices
- Review Analytics Weekly: Check for trends and issues
- A/B Test Changes: Compare metrics before and after form updates
- Focus on High-Volume Forms: Optimize forms with the most submissions first
- Monitor Abandonment: Set up alerts for sudden drops in completion rate
- Respect Privacy: Never log field values or personally identifiable information