Tracks form views, persisted submissions, and abandonments. PRO feature.
Event Types
| Event | When Tracked | Trigger Location |
|---|---|---|
view | Form is rendered | FORMFORGE_Form_Renderer::render() |
submit | Submission saved (the test submission of the form builder is not tracked) | FORMFORGE_Form_Handler::handle_submit() |
abandon | A new partial draft saved (the first save of a session) | FORMFORGE_Abandonment::ajax_save_partial() |
Querying Stats
php
$stats = FORMFORGE_Analytics::instance()->get_stats( $form_id );
// [ "views" => 1250, "submissions" => 87, "conversion_rate" => 7.0 ]get_stats() intentionally counts submissions from completed rows in wp_formforge_submissions (COALESCE(status, '') NOT IN ('abandoned', 'test')) and uses wp_formforge_analytics only for view events. This keeps the All Forms responses column, Analytics dashboard, and Submissions page consistent even if an old or diagnostic submit event exists without a matching saved submission. Abandoned rows are reported only through the Abandoned metric, and the test submissions of the form builder (status test) are not counted. The rate is rounded to one decimal and capped at 100.
Conversion Rate Caching
Results are cached for 5 minutes via WordPress transients. Tracking an event of a form clears the cached stats of that form for the 7, 30 and 90 day windows only; a call with another number of days stays cached until its 5 minutes are over:
php
$cache_key = 'formforge_stats_v3_' . $form_id . '_' . $days;
set_transient( $cache_key, $result, 5 * MINUTE_IN_SECONDS );—