Skip to content

A/B Split Test Conversational Forms vs Normal Forms in Gravity Forms

Test whether the Conversational Forms add-on actually converts better than the standard Gravity Forms layout using a custom split-test plugin with unified tracking.

Chris Eggleston 3 min read

Problem

You want to test whether the Conversational Forms version of your Gravity Form actually converts better than the standard layout. Maybe you saw the add-on and wondered: “Does this look cooler, or does it actually get more submissions?”

The challenge: Gravity Forms has no built-in A/B testing. And testing two different form layouts requires randomly serving visitors different versions and tracking which one drives more submissions.

Solution

Use a custom plugin to split traffic between the same form displayed two ways: once as a standard embed, and once with Conversational Forms enabled. The plugin tracks impressions, submissions, and conversion rates in a single WordPress dashboard widget.

Want the full tutorial? For a complete walkthrough with three different approaches (including third-party options), see: How to A/B Test Gravity Forms: Split Traffic and Track Results.

Option 1: Custom A/B Split Test Tracker Plugin (Recommended)

This lightweight plugin randomly displays one of two forms, tracks impressions via JavaScript, logs submissions through a Gravity Forms hook, and shows unified results in a WordPress dashboard widget.

How it works:

  • Randomly serves Form A or Form B via shortcode (50/50 split)
  • Tracks impressions via frontend AJAX when the form renders
  • Tracks submissions via the gform_after_submission hook
  • Shows results in a WordPress dashboard widget with conversion rates

Step 1: Prepare Your Two Form Versions

Because Conversational Forms is a per-form setting, you need two copies of the same form:

  1. Create your standard form with all the fields you need.
  2. Duplicate the form (Forms → hover → Duplicate).
  3. On the duplicate, enable Conversational Forms: Form Settings → Conversational Forms → Enable.
  4. Customize the conversational version with welcome text, progress bar, etc.
  5. Test both forms independently to make sure they submit correctly before running the split test.

Note: Entry data lives in two separate forms. There is no automatic way to merge entries from Form A and Form B into a single report. You must compare the two forms’ entry counts via the dashboard widget.

Step 2: Install the Plugin

Create a new file in wp-content/plugins/ named gravity-forms-ab-split-test.php, or paste the code into a snippet manager like WPCodeBox.

ab-split-test-tracker.phpGist by chriseggGitHub
<?php
/**
 * Plugin Name: Gravity Forms A/B Split Test Tracker
 * Description: Randomly displays one of two Gravity Forms for A/B testing and tracks impressions and submissions in a custom dashboard widget.
 * Version: 1.0
 * Author: Your Name
 * License: GPL2
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Create custom table for tracking A/B test data.
 */
function gf_ab_split_test_create_table() {
	global $wpdb;
	$table_name = $wpdb->prefix . 'gf_ab_test';
	$charset_collate = $wpdb->get_charset_collate();

	$sql = "CREATE TABLE IF NOT EXISTS $table_name (
		form_id INT NOT NULL,
		impressions INT DEFAULT 0,
		submissions INT DEFAULT 0,
		PRIMARY KEY (form_id)
	) $charset_collate;";

	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
	dbDelta( $sql );
}
register_activation_hook( __FILE__, 'gf_ab_split_test_create_table' );

/**
 * AJAX handler: Track a form impression.
 */
function gf_ab_split_test_track_impression() {
	if ( isset( $_POST['form_id'] ) ) {
		global $wpdb;
		$table_name = $wpdb->prefix . 'gf_ab_test';
		$form_id = intval( $_POST['form_id'] );

		$wpdb->query(
			$wpdb->prepare(
				"INSERT INTO $table_name (form_id, impressions, submissions) VALUES (%d, 1, 0)
				 ON DUPLICATE KEY UPDATE impressions = impressions + 1",
				$form_id
			)
		);
	}
	wp_die();
}
add_action( 'wp_ajax_gf_ab_split_test_track_impression', 'gf_ab_split_test_track_impression' );
add_action( 'wp_ajax_nopriv_gf_ab_split_test_track_impression', 'gf_ab_split_test_track_impression' );

/**
 * Gravity Forms hook: Track form submissions.
 */
function gf_ab_split_test_track_submission( $entry, $form ) {
	global $wpdb;
	$table_name = $wpdb->prefix . 'gf_ab_test';
	$form_id = $form['id'];

	$wpdb->query(
		$wpdb->prepare(
			"INSERT INTO $table_name (form_id, impressions, submissions) VALUES (%d, 0, 1)
			 ON DUPLICATE KEY UPDATE submissions = submissions + 1",
			$form_id
		)
	);
}
add_action( 'gform_after_submission', 'gf_ab_split_test_track_submission', 10, 2 );

/**
 * Enqueue front-end JavaScript to track form impressions.
 */
function gf_ab_split_test_enqueue_tracking_script() {
	if ( ! is_admin() ) {
		?>
		<script type="text/javascript">
			document.addEventListener("DOMContentLoaded", function() {
				// Look for Gravity Forms wrappers (they have class "gform_wrapper")
				var forms = document.querySelectorAll(".gform_wrapper");
				forms.forEach(function(form) {
					// Extract form ID from the wrapper element (e.g., gform_wrapper_5 becomes 5)
					var formId = form.id.replace("gform_wrapper_", "");
					// Send an AJAX request to record the impression
					fetch("<?php echo admin_url('admin-ajax.php'); ?>", {
						method: "POST",
						headers: {
							"Content-Type": "application/x-www-form-urlencoded"
						},
						body: "action=gf_ab_split_test_track_impression&form_id=" + formId
					});
				});
			});
		</script>
		<?php
	}
}
add_action( "wp_footer", "gf_ab_split_test_enqueue_tracking_script" );

/**
 * Add a dashboard widget to display A/B test tracking results.
 */
function gf_ab_split_test_add_dashboard_widget() {
	wp_add_dashboard_widget(
		'gf_ab_split_test_dashboard_widget',
		'Gravity Forms A/B Testing Results',
		'gf_ab_split_test_render_dashboard_widget'
	);
}
add_action( 'wp_dashboard_setup', 'gf_ab_split_test_add_dashboard_widget' );

function gf_ab_split_test_render_dashboard_widget() {
	global $wpdb;
	$table_name = $wpdb->prefix . 'gf_ab_test';
	$results = $wpdb->get_results( "SELECT * FROM $table_name ORDER BY impressions DESC" );

	if ( empty( $results ) ) {
		echo "<p>No data available.</p>";
		return;
	}

	echo "<table class='widefat'>";
	echo "<thead><tr><th>Form ID</th><th>Impressions</th><th>Submissions</th><th>Conversion Rate</th></tr></thead><tbody>";
	
	foreach ( $results as $row ) {
		$conversion_rate = ( $row->impressions > 0 ) ? round( ( $row->submissions / $row->impressions ) * 100, 2 ) . "%" : "0%";
		echo "<tr>
				<td>" . esc_html( $row->form_id ) . "</td>
				<td>" . esc_html( $row->impressions ) . "</td>
				<td>" . esc_html( $row->submissions ) . "</td>
				<td>" . esc_html( $conversion_rate ) . "</td>
			  </tr>";
	}
	echo "</tbody></table>";
}

/**
 * Shortcode for A/B split test between two forms.
 * Usage: [gf_ab_split_test form_a="1" form_b="2" title="false" description="false" ajax="true"]
 */
function gf_ab_split_test_shortcode( $atts ) {
	$atts = shortcode_atts( array(
		'form_a'      => '',
		'form_b'      => '',
		'title'       => 'false',
		'description' => 'false',
		'ajax'        => 'true'
	), $atts, 'gf_ab_split_test' );

	if ( empty( $atts['form_a'] ) || empty( $atts['form_b'] ) ) {
		return 'Please specify both form_a and form_b attributes.';
	}

	// Randomly choose one of the two forms (50/50 split).
	$selected_form = ( rand( 0, 1 ) === 0 ) ? $atts['form_a'] : $atts['form_b'];

	// Build the Gravity Form shortcode.
	$shortcode = sprintf(
		'

Oops! We could not locate your form.

', $selected_form, $atts['title'], $atts['description'], $atts['ajax'] ); return do_shortcode( $shortcode ); } add_shortcode( 'gf_ab_split_test', 'gf_ab_split_test_shortcode' );

Note: If you paste this into functions.php, theme updates will overwrite it. Use a custom plugin file or a snippet manager instead.

Step 3: Embed the Shortcode on Your Test Page

Add this shortcode to any page or post using a Shortcode block:

[gf_ab_split_test form_a="1" form_b="2" title="false" description="false" ajax="true"]

Replace 1 with your standard form ID and 2 with your conversational form ID. You can find the form ID in the Forms → All Forms list.

Step 4: View Results

Go to your WordPress Dashboard and look for the Gravity Forms A/B Testing Results widget. It shows impressions, submissions, and conversion rate for each form side by side.

Limitations:

  • Impression tracking relies on JavaScript — users with JS disabled won’t be counted.
  • Requires caching exclusion on the test page (server caches can break random rotation).
  • Conversational Forms requires an Elite or Nonprofit license.
  • No statistical confidence calculation — you interpret the conversion rate manually.

Option 2: Third-Party A/B Testing Tools

If you prefer a dedicated A/B testing platform, these work with Gravity Forms:

  • Rocket Apps A/B/C Testing — Built specifically for Gravity Forms. Supports up to 3 variations, automatic winner selection, sticky visitor assignment, CSV/PDF export, and built-in caching support.
  • Nelio A/B Testing — WordPress-native, supports full-page experiments.
  • A/B Split Test — Simple split testing for WordPress pages.

These are overkill if you just want to test two Gravity Forms, but useful if you’re already running broader page-level experiments.

Need More Help?

If you still need help, use the chat or leave a comment below and we’ll get back to you.

Comments

Ask a question or leave a comment

Your email is never shown. For help with a specific form, share what you expected and what happened instead.