Two AI-powered features: form generation and submission analysis. PRO with AI credits.
Form Generation
$ai = FORMFORGE_AI_Client::instance();
if ( $ai->is_configured() ) {
$fields = $ai->generate_form( 'Create a restaurant reservation form' );
if ( ! is_wp_error( $fields ) ) {
$form_id = FORMFORGE_Form_Builder::instance()->create( [
'title' => 'Restaurant Reservation',
'fields' => $fields,
] );
}
}Submission Analysis
$analyzer = FORMFORGE_Submissions_AI::instance();
$result = $analyzer->analyze_form( 1 );
if ( ! is_wp_error( $result ) ) {
echo "Conversion Score: {$result['score']}/100n";
foreach ( $result['insights'] as $insight ) {
echo "[P{$insight['priority']}] {$insight['title']}n";
echo " Source: {$insight['source']} / confidence {$insight['confidence']}n";
echo " Action: {$insight['action']}n";
}
printf(
"Sample: %d submissions, %d abandoned, %d failed paymentsn",
$result['metadata']['sample_size'],
$result['metadata']['abandoned_or_partial_sessions'],
$result['metadata']['failed_payment_events']
);
}Results include metadata (sample_size, completed/abandoned/failed-payment counts, conversion rate, confidence, analyzed_at, cache_expires_at) and each normalized insight includes source (analytics, ai_ux, or heuristic) plus confidence. The admin UI labels cached results and keeps a short local history so repeated analysis on unchanged data is explainable instead of looking like a fresh opaque answer. formforge_ai_analysis_status with job_id = 0 returns the cached result only; formforge_ai_analyze accepts force_refresh = 1 for a new credit-spending run.
Submissions and Analytics recommendation CTAs deep-link to the editor with ff_ai_field, ff_ai_action, ff_ai_title, and ff_ai_note query parameters when an insight has a field_id. assets/js/admin.js resolves the target against the builder’s saved field JSON, scrolls and highlights the field card, adds an .ff-ai-target-badge rendered as a neutral “AI suggestion” marker, opens the field settings panel, and prepends an inline .ff-ai-editor-note so the recommendation remains visible beside the controls. In editor context, apply buttons call window.formforgeOpenAiTargetField() after mutating the draft and include an action-specific status such as Changed required to optional in both the button and note. If the insight is form-level and has no field_id, the CTA still opens the editor without a field target. The editor panel uses .ff-ai-analysis-panel--editor with a capped insight list so analysis results do not push the builder far down the page.
Insight Types
| Type | Description | Suggested Action |
|---|---|---|
remove_field | Remove a low-value field | Delete field |
make_optional | Change required to optional | Toggle required off |
split_form | Too many fields | Add page_break fields |
simplify_label | Confusing label | Edit label text |
—