Skip to content

Surveys, A/B Tests & Integrations

Beyond lead capture, Forms includes built-in survey analytics, multi-variant A/B testing, and seven optional sibling module integrations isolated cleanly under src/Integration/<Module>/.

SurveyAggregator computes choice distributions, percentages, numeric averages, and Net Promoter Scores (NPS) across non-spam submissions (up to $maxSample = 5000 by default):

<?php namespace ProcessWire;
$forms = Forms::requireInstance($wire);
// Structured analytics array
$metrics = $forms->surveyResults('charter-inquiry');
// Accessible frontend SVG charts (requires allow_public_survey_results or $force = true)
echo $forms->renderSurveyResults('charter-inquiry');
Review real-time distributions and rating averages inside Setup -> Forms -> Surveys & Polls or embed SVG charts on the frontend.

Define experiments in Setup -> Forms -> A/B Testing (forms-ab-tests) comparing two or more form variants with custom traffic weights:

<?php namespace ProcessWire;
$forms = Forms::requireInstance($wire);
// Selects a sticky weighted variant, records 'served', and renders the form
echo $forms->renderAbTest('charter-inquiry-layout', ['theme' => 'modern']);
// Record custom funnel events programmatically ('served' | 'interacted' | 'failed' | 'completed')
$forms->recordAbTestEvent('charter-inquiry-layout', 'charter-inquiry-short', 'completed');

Browser interaction beacons route through /_forms/ab-event (AbTestManager::recordPublicEvent()) with per-IP rate limiting, per-session 'interacted' deduplication, and atomic counters in forms_ab_counters.

Module Integration Capabilities
Ai Prompt-to-form generation in the Visual Builder (___generateFormSpecFromPrompt), ai field enrichment, classifySubmission() spam evaluation, and FormsCapabilityProvider (scopes forms:read, forms:write, forms:delete; resources pw://forms/catalog, pw://forms/{slug}; tools forms_list, forms_get, forms_save, forms_submissions_query, forms_submissions_organize, forms_submissions_delete).
Currency Constructs exact minor-unit Money values (resolveMoneyObject) and populates ISO currency dropdowns.
Payments Processes payment fields via hosted /pay/{token} links and recurring subscriptions (processPaymentIntent) and triggers deliverAfterPayment() on afterPaymentLinkPaid, afterPurchase, afterSubscribe, and afterFailure.
Contacts Upserts contacts on afterSubmit, records immutable ConsentPurpose::MarketingEmail consents via Contacts::recordConsent(), exports submission data under modules.forms (collectSubjectData), anonymizes on afterAnonymize, and re-links submissions on afterMerge.
Campaign Subscribes consenting visitors directly to mailing lists via Campaign::subscribe().
Headless Exposes /api/v1/forms/* (GET /forms, GET /forms/{slug}, GET /forms/{slug}/token, POST /forms/{slug}/validate-step, POST /forms/{slug}/submit, GET /forms/{slug}/survey-results, DELETE /forms/{slug}/submissions/{token}, GET /forms/ab-tests/{handle}, POST /forms/ab-tests/{handle}/events).
Media Stores uploaded attachments in Media Private Vault (owner: 'forms'), streams authenticated downloads, provides temp files for email/webhook attachments, cascades deletion on submission/GDPR erasure, and resolves image_block Media Library assets (falling back cleanly to EntryFilesManager when uninstalled).

Next steps