WordPress plugin intelligence profile

Beta Flags … now with A/B Testing!

Thanks to: James Williams, whose plugin inspired this one (https://github.com/jamesrwilliams/feature-flags)

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 4.9
Current version1.3.0
WordPress coverageTested up to WordPress 4.9
Minimum stackWP 3.0 · PHP —
Directory statusactive
Last directory update2 Nov 20188y ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Beta Flags … now with A/B Testing! version 1.3.0 as active, updated 8y ago and tested up to WordPress 4.9.

Overview

About this plugin

Beta Flags allow developers to manage the release of new features. Instead of having code execute as soon as it is deployed to the production environment. You can now wrap it in a beta flag conditional and activate it from the back end.

A/B Testing works very similarly, except that instead of turning a code block on or off, they allow you to turn it on 50% of the time. g. Adobe Omniture, Google 360).

The Basics of Beta Flags

To create a new beta flag, open the configuration JSON file. json. json ).

The JSON file follows the format below:

{

"flags": {

"sidebar_web": {

"title": "Beta Flags IN THEME",

"description": "Add a sidebar to the post page",

"author": "Charles Jaimet"

},

"library_admin": {

"title": "Beta Flags QA: Plugin Admin Test",

"description": "For Beta Flag testing in admin interface",

"author": "Charles Jaimet"

}

}

}

g. sidebar_web, library_admin), representing an object with a title, description, and author. The key must be unique, and is used throughout to identify the given flag.

page=beta-flags ). Here you will find the flags from your JSON file if you have created it correctly.

A note about JSON, the easiest mistake to make is to put a comma after the last element in an array or object. This will break the JSON but is easy enough to fix when you know what to look for. Kinda like forgetting a semi-colon in PHP.

Stupid semi-colons…

When you first load the plugin, and any time after you update the JSON file, you should return to this admin screen. New flags are disabled by default, and can only be enabled here. Check the box in the Enabled column beside each flag you want to turn on.

Click Save Changes when done.

In your theme or other plugins, you can use these beta flag keys to control feature execution by wrapping a conditional around the relevant code. Try to group your wrapped code into a single function, method, or class to avoid littering your theme with beta flag conditionals.

The public function beta_flag_enabled( $key ) will return a true|false value if the beta flag is enabled.

Some examples:

if ( beta_flag_enabled( 'sidebar_web' ) ) {

get_sidebar();

}

if ( beta_flag_enabled( 'new_design' ) ) {

0', false );

wp_enqueue_style( 'my_styles' );

}

if ( beta_flag_enabled( 'popup_offer' ) ) {

1 );

}

I suggest using beta flag keys that make sense and convey their purpose. Adding a version number never hurt, either. There is no character limit, so go nuts.

5' ) ) {

get_sidebar();

}

A/B Testing

Now you have your beta flags and you’ve embedded them in your code. The feature works as expected and you have it running on production. Is it better than what it replaced?

Enter A/B testing.

Check the A/B Test box beside the flag you want to test in the admin interface (see screen shot below), and check the “Enable beta testing” box at the bottom of the flag list, then click “Save Changes”.

Go to your website and refresh a few times. ab=1 appended to their URLs. g.

ab=1 ).

When a visitor follows one of these links they will see your page with the beta flag disabled. g. test/hello-world/ ) they will see the page with the beta flag enabled.

The query string is randomly appended 50% of time, so two visitors may follow the same link in the sidebar or menu, and one will get the flag turned on and one will get it turned off.

Because the URL matches the state of the beta flag, you will be able to see in your analytics service which experience visitors engaged with more. Implementing an effective A/B testing campaign is outside the scope of a README file but there are plenty of good reference books and sites.

As long as the “Enable beta testing” box is checked, post and term URLs on your site will get this query string treatment. Only beta flags that have the A/B Test box checked will be affected. Those with it unchecked will be controlled strictly by their Enabled box.

Note also that checking A/B Test on a flag that is disabled will have no effect. Off is off.

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • ab testing
  • beta flags
  • feature flags
  • a
  • b
  • developers
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 4.9

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 4.9.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to4.9
Minimum requirementsWordPress 3.0 · PHP not listed
Update activity2 Nov 20188y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.