Skip to content

Commit

Permalink
Merge pull request #1 from the-markup/count-granularity
Browse files Browse the repository at this point in the history
Count granularity
  • Loading branch information
dphiffer authored Aug 6, 2024
2 parents 0df7e0c + eb6f6e7 commit 7a17f33
Show file tree
Hide file tree
Showing 27 changed files with 842 additions and 492 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ node_modules
*.sql
*.tar.gz
*.zip
assets
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This is for the ACF Pro installer plugin
# See: https://github.com/dphiffer/acf-pro-installer
# ACF_PRO_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ node_modules/
*.zip
build/
auth.json
vendor/
vendor/
/.env
8 changes: 8 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ module.exports = function( grunt ) {
your_target: {
files: {
'README.md': 'readme.txt'
},
options: {
screenshot_url: "assets/{screenshot}.png",
post_convert: readme => {
// Omit the WordPress readme.txt header tags
readme = readme.replace(/^\*\*(.+?):\*\* .+\s\s\n/gm, '');
return readme;
}
}
},
},
Expand Down
79 changes: 61 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Split Tests #
**Contributors:** [themarkup](https://profiles.wordpress.org/themarkup/)
**Donate link:** https://themarkup.org/donate
**Tags:** split-tests
**Requires at least:** 4.5
**Tested up to:** 6.6
**Requires PHP:** 5.6
**Stable tag:** 0.0.3
**License:** GPLv2 or later
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html

Basic A/B testing for WordPress.

## Description ##

TK
A WordPRess plugin to add A/B split tests without tracking individual users. Currently there are two kind of tests:

* **Post title tests**: test multiple headlines for a single post.
* **DOM tests**: test arbitrary changes to text based on DOM manipluations.

Depends on [Advanced Custom Fields Pro plugin](https://www.advancedcustomfields.com/pro/), which you will need to install and license separately.

## Installation ##

Expand All @@ -22,23 +17,71 @@ This section describes how to install the plugin and get it working.
1. Upload `split-tests/` to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress

## Developer setup ##

This repo contains everything you need to get a test environment setup using the official [WordPress docker image](https://hub.docker.com/_/wordpress).

__Developer dependencies__

* [node.js](https://nodejs.org/) (tested on v20)
* [nvm](https://github.com/nvm-sh/nvm#readme)
* [Docker Desktop](https://www.docker.com/products/docker-desktop)

__Build and start__

./bin/build
./bin/start

__Local website__

Once you've built and started the docker containers, you can load up the website at [localhost:8080](http://localhost:8080). If you reload the page a couple times, you should see parts of the page change in response to two tests that are set up.

1. **DOM test:** there are two variants for the about text "A commitment to innovation and sustainability" and "A commitment to maintenance and durability". If you click on the "About us" button, that will register as a conversion for a given variant.
2. **Post title:** there are three variants for the Hello World post, if you scroll down to "Watch, Read, Listen" and reload you should see English, Spanish, and French versions of "Hello World." Clicking through to load the post will register as a conversion for that test.

__WordPress admin credentials__

Username: `admin`
Password: `password`

You can explore the example tests by clicking on [Split Tests](http://localhost:8080/wp-admin/edit.php?post_type=split_test) in the admin sidebar.

## Frequently Asked Questions ##

### A question that someone might have ###
### Did you say there's no tracking? ###

Yes, we count how many times a test is seen and how many times it converts, but we don't set/read cookies or otherwise attempt to track individual requests.

### How do you define a conversion? ###

There are currently two kinds of conversions: **page loads** and **clicks** (on a specific configured element).

An answer to that question.
### Does the plugin handle front-end caching? ###

Yes, the tests will work fine with HTML generated behind a CDN, or using other kinds of front-end caching.

## Screenshots ##

TK
### 1. Split Tests posts page ###
![Split Tests posts page](assets/screenshot-1.png)

### 2. Split Test post editor ###
![Split Test post editor](assets/screenshot-2.png)

### 3. Post Title variants ###
![Post Title variants](assets/screenshot-3.png)


## Changelog ##

### 0.0.1 ###
Split tests for post titles
### 0.0.4 ###
Adds a cron mechanism to combine raw events in the database into daily aggregates

### 0.0.3 ###
Context for where tests run ('all', 'home', or a 'url' pattern)

### 0.0.2 ###
Split tests for DOM changes

### 0.0.3 ###
Context for where tests run ('all', 'home', or a 'url' pattern)
### 0.0.1 ###
Split tests for post titles
Binary file added assets/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ set -o nounset
source ~/.nvm/nvm.sh
nvm use

if [ ! -f .env ] ; then
echo "Setting up .env ..."
echo
cp .env.sample .env
echo

echo "What is your ACF Pro key?"
read -p "> " ACF_PRO_KEY
echo >> .env
echo "# This is for the ACF Pro installer plugin" >> .env
echo "# See: https://github.com/dphiffer/acf-pro-installer" >> .env
echo "ACF_PRO_KEY=$ACF_PRO_KEY" >> .env
echo
echo "Thank you!"
fi

echo "Building and then starting containers..."
echo
docker compose build
Expand Down
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ services:
WORDPRESS_CONFIG_EXTRA: |
define('WP_DEBUG_LOG', '/var/log/wordpress.debug.log');
define('WP_DEBUG_DISPLAY', false);
COMPOSER_AUTH: |
{
"http-basic": {
"connect.advancedcustomfields.com": {
"username": "${ACF_PRO_KEY}",
"password": "http://localhost:8080"
}
}
}
ACF_PRO_KEY: ${ACF_PRO_KEY}
volumes:
- .:/var/www/html/wp-content/plugins/split-tests
db:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "themarkup/split-tests",
"description": "Simple A/B testing for WordPress",
"version": "0.0.3",
"version": "0.0.4",
"type": "wordpress-plugin",
"repositories": [
{
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions languages/split-tests.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# This file is distributed under the same license as the Split Tests package.
msgid ""
msgstr ""
"Project-Id-Version: Split Tests 0.0.3\n"
"Project-Id-Version: Split Tests 0.0.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/split-tests\n"
"POT-Creation-Date: 2024-07-30 16:54:11+00:00\n"
"POT-Creation-Date: 2024-08-06 14:07:55+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
Loading

0 comments on commit 7a17f33

Please sign in to comment.