ShrimpTest is built from the ground up to be an extensible framework for users and developers. Developers can write custom metric types and custom variant types, simplifying experiment creation and administration.

Creating a New Custom Variant or Metric Type

Custom variant and metric types can be created via a WordPress plugin, in a theme (for example, in functions.php), or as a ShrimpTest plugin, stored in plugins/shrimptest/plugins. However, please note that the entire shrimptest directory is normally overwritten when upgrading to a newer version of the plugin, so it may be preferable to write custom variant and metric types as their own WordPress plugins.

Note: In most cases familiarity with the general WordPress filter and action API model will be essential.

Writing a Custom Variant Type

A custom variant type represents a certain kind of variation whose effectiveness you would like to test. An example of a custom variant type is the built-in [ab] shortcode variant type, or the built-in post title variant type. You can write custom variant types for trying out different header images, different post titles, or to test out entirely different themes. The possibilities are endless!

Custom metric types are registered using the register_shrimptest_variant_type function:


$name is the internal name of the variant type. This is not a user-facing string and must be unique.

$args is an array or object with a collection of properties about this custom variant type. Here is a list of properties which $args may have:

  • name (required):

Writing a Custom Metric Type

A custom metric type represents a type of metric which can be used as the . Metrics must be quantifiable, and custom metric types include the code to calculate these metrics and record them for visitors participating in an experiment. In addition, custom metrics may include their own parameters and associated settings-type UI. An example of a custom metric type is the built-in conversion metric type.