Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

A/B paragraphs

18 sites No security coverage
View on drupal.org

This module allows editors to create A/B tests directly within Drupal content using a new "A/B Test" paragraph type. It enables testing two content variants with configurable display ratios and helps track user interactions by sending simple analytics events.

A/B Paragraphs is a lightweight module for running basic A/B tests using the Drupal Paragraphs system. Editors can test two content variants, track user interaction, and send simple analytics events.

Features

A/B Paragraphs adds a new Paragraph type called A/B Test that allows editors to run basic A/B tests within Drupal content. Each test consists of Variant A and Variant B, with configurable display ratios (e.g., 50/50, 90/10).

Only one variant is shown to a user per session, and the rendering is handled on the frontend using JavaScript. The module suggests tracking code for each variant based on links found in the content. Editors are free to edit or replace these suggestions.

The module does not perform analytics or reporting itself but allows you to send click events to your analytics tool (e.g., Google Analytics or Matomo).

  • A/B Test Paragraph type with two content variants
  • Session-based rendering: one variant per user per session
  • Unique ID and configurable distribution ratio
  • Separate tracking code fields for each variant
  • Tracking code suggestions based on link analysis
  • Show event tracking on pageload when a variant is shown
  • Click event tracking via onclick attributes

Post-Installation

After installation, the module automatically creates a new Paragraph type called ab_test and adds the following fields:

  • field_variant_a
  • field_variant_b
  • field_tracking_code_a
  • field_tracking_code_b
  • field_unique_id
  • field_distribution

Manual configuration is required to enable and arrange the fields:

  • Go to: /admin/structure/paragraphs_type/ab_test/form-display
  • Then to: /admin/structure/paragraphs_type/ab_test/display

Ensure that the tracking code fields use the Plain text (multiple lines) widget and that all necessary fields are enabled, visible, and editable.

Additional Requirements

This module requires the Paragraphs module.

This module is compatible with any analytics solution that accepts custom events. Common choices include:

Similar projects

For more advanced A/B testing functionality—including multivariate testing, targeting, personalization, and analytics dashboards—consider:

  • VWO – Full-featured testing, heatmaps, and audience segmentation
  • Optimizely – Robust experimentation platform with strong Drupal integration

Unlike those platforms, A/B Paragraphs is minimal and does not require external services.

Supporting this Module

If you find this module useful and want to support future development, feel free to reach out via the issue queue or contribute code and feedback.

Community Documentation

Documentation, usage guides, and examples will be added as the module evolves. Contributions are welcome.

Known issues / to do:

  • It should not be possible to nest an A/B Test paragraph inside another A/B Test paragraph.
  • Unclear whether tracking code suggestions work for all link types (e.g., entity references).
  • Tracking code suggestions are currently tailored to Matomo only. When another analytics provider (such as Google Analytics) is selected, the suggestions should adjust accordingly.
  • Tracking code suggestions may not work correctly when multiple A/B Test paragraphs are used on the same page. It might not be desirable to support more than one A/B test per page.
  • The module contains some temporary logging code, which should be removed in a future release.

Activity

Total releases
9
First release
Apr 2025
Latest release
4 months ago
Releases (12 mo)
3 ▼ from 6
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0-beta3 Pre-release Feb 20, 2026
1.0.0-beta2 Pre-release Dec 21, 2025
1.0.0-beta1 Pre-release Dec 16, 2025
1.0.0-alpha5 Pre-release Apr 17, 2025
1.0.0-alpha4 Pre-release Apr 3, 2025
1.0.0-alpha3 Pre-release Apr 2, 2025
1.0.0-alpha2 Pre-release Apr 2, 2025
1.0.0-alpha1 Pre-release Apr 2, 2025
1.0.x-dev Dev Apr 1, 2025