Search by

jholt / craft-wink

justinholtweb

A/B testing & experimentation plugin for Craft CMS

Package info

github.com/justinholtweb/craft-wink

Documentation

Type:craft-plugin

pkg:composer/jholt/craft-wink

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

5.0.6 2026-10-04 14:39 UTC

This package is auto-updated.

Last update: 2026-10-04 14:40:25 UTC


README

A/B testing and experimentation plugin for Craft CMS 5. Create experiments with content variants, track conversions, and determine winners with statistical significance — all from within the Control Panel.

Requirements

  • Craft CMS 5.0+
  • PHP 8.2+

Installation

composer require justinholtweb/craft-wink
php craft plugin/install wink

Features

  • Experiments as Elements — full Craft element index with statuses, search, and filtering
  • Server-side variant assignment — deterministic hashing means no flicker and cache-safe
  • Conversion goals — page views, clicks, form submissions, or custom events
  • Statistical significance — two-proportion z-test with Wilson score confidence intervals
  • Reports dashboard — conversion rates, uplift, confidence levels, and time-series charts
  • Twig integration — functions, block tags, and template variables
  • Frontend tracker — lightweight JS (~3KB gzipped) with event batching
  • GA4/GTM forwarding — optional integration with Google Analytics and Tag Manager
  • Privacy-first — respects Do Not Track, IP anonymization, configurable retention

Usage

Twig Functions

{# Output variant content directly #}
{{ winkVariant('headline-test') }}

{# Full control over variant rendering #}
{% set test = winkExperiment('headline-test') %}
{% if test and test.variant.handle == 'variant-a' %}
    <h1>Discover Something New</h1>
{% else %}
    <h1>Welcome</h1>
{% endif %}

{# Block syntax with inline variants #}
{% experiment 'headline-test' %}
    {% variant 'control' %}<h1>Welcome</h1>{% endvariant %}
    {% variant 'variant-a' %}<h1>Discover</h1>{% endvariant %}
{% endexperiment %}

{# Add tracking script before </body> #}
{{ winkTrackingScript() }}

Template Variables

{# Query experiments #}
{% set experiments = craft.wink.experiments.experimentStatus('running').all() %}

{# Get assigned variant handle #}
{% set variant = craft.wink.variant('headline-test') %}

JavaScript Conversions

// Record a conversion
Wink.convert('signup-goal', { plan: 'pro' });

A conversion counts only for a goal the experiment has, and only from a visitor who has had an impression of it. Repeat conversions are recorded, but rates and significance count each converted visitor once.

Permissions

Permission Lets someone
Manage experiments Create, edit, start, pause, end and delete experiments, and declare a winner. Variant content is published on the site as HTML, so treat this like the right to edit templates.
View experiment reports Read the reports

Settings are admin-only, and saved only where admin changes are allowed.

The tracking endpoint

/wink/track is public, so it takes no more than a page would send: at most 25 events a request, and trackingBudgetPerMinute (120 by default) per address. Behind a proxy or CDN, set Craft's trustedHosts, or every visitor shares the proxy's budget.

License

Proprietary. See LICENSE.md.