Shortcodes

In many cases, WordPress shortcodes are a simple and easy way to test simple bits of text, or to drop a report onto a page.

Teams plan customers also get a special shortcode for automatic reporting.

Test Variations

Content inside the shortcode is used as your test content. Set eid to your experiment ID (the ID of the test you published) and give each version a var name. The exact shortcode for your test is shown on the test edit screen, ready to copy.

[ab_split_test eid="1234" var="default"]Buy Now![/ab_split_test][ab_split_test eid="1234" var="cart"]Add to cart[/ab_split_test]

Attributes:

  • eid - your experiment ID.
  • var - the variation name. This is the label you’ll see in your results.
  • wrap - the HTML tag the content is wrapped in. Defaults to span; use div if you’re wrapping block-level content.

The shortcode simply wraps your content in the variation class, so the two examples above are the same as writing <span class="ab-var-1234-default">Buy Now!</span> yourself. See On-page split testing with any (or no) page builder for the class-based approach.

Conversions

There is no conversion shortcode. Conversions are triggered with a CSS class instead, which works anywhere a shortcode would and in plenty of places one wouldn’t.

Add the conversion class to any element that appears on the page when the visitor converts - a thank-you message, an order-received block, a confirmation panel. Replace 1234 with your experiment ID:

ab-convert-1234

To fire a conversion when an element is clicked rather than when it loads, use:

ab-click-convert-1234

The test edit screen shows both classes for your test under the conversion settings. For the full picture of conversion options - page visits, button clicks, scroll depth, time on page and more - see the Conversions guide.

Reports (Teams plan)

Display a report in your emails or create a results page on your website.

[ab_split_test_report]

Add emailreport="true" for the email-friendly version. On a Free licence the shortcode prints an upgrade notice instead of the report. Developers can switch it off entirely with the bt_ab_shortcode filter. See Reporting Shortcode for the details.

2 Comments

  1. Graham George on October 8, 2023 at 8:36 pm

    Agency Only: [[ab_split_test_report]]

    Does not work on the LTD version of the plugin atm.

    • Tom on October 11, 2023 at 1:40 pm

      Sorry there was an issue with the article, it’s now been updated. It is a single square bracket around ab_split_test_report



Leave a Comment

You must be logged in to post a comment.