Skip to content

Commit 7a17f33

Browse files
authored
Merge pull request #1 from the-markup/count-granularity
Count granularity
2 parents 0df7e0c + eb6f6e7 commit 7a17f33

27 files changed

+842
-492
lines changed

.distignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ node_modules
4141
*.sql
4242
*.tar.gz
4343
*.zip
44+
assets

.env.sample

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This is for the ACF Pro installer plugin
2+
# See: https://github.com/dphiffer/acf-pro-installer
3+
# ACF_PRO_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ node_modules/
99
*.zip
1010
build/
1111
auth.json
12-
vendor/
12+
vendor/
13+
/.env

Gruntfile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ module.exports = function( grunt ) {
2323
your_target: {
2424
files: {
2525
'README.md': 'readme.txt'
26+
},
27+
options: {
28+
screenshot_url: "assets/{screenshot}.png",
29+
post_convert: readme => {
30+
// Omit the WordPress readme.txt header tags
31+
readme = readme.replace(/^\*\*(.+?):\*\* .+\s\s\n/gm, '');
32+
return readme;
33+
}
2634
}
2735
},
2836
},

README.md

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
# Split Tests #
2-
**Contributors:** [themarkup](https://profiles.wordpress.org/themarkup/)
3-
**Donate link:** https://themarkup.org/donate
4-
**Tags:** split-tests
5-
**Requires at least:** 4.5
6-
**Tested up to:** 6.6
7-
**Requires PHP:** 5.6
8-
**Stable tag:** 0.0.3
9-
**License:** GPLv2 or later
10-
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
11-
122
Basic A/B testing for WordPress.
133

144
## Description ##
155

16-
TK
6+
A WordPRess plugin to add A/B split tests without tracking individual users. Currently there are two kind of tests:
7+
8+
* **Post title tests**: test multiple headlines for a single post.
9+
* **DOM tests**: test arbitrary changes to text based on DOM manipluations.
10+
11+
Depends on [Advanced Custom Fields Pro plugin](https://www.advancedcustomfields.com/pro/), which you will need to install and license separately.
1712

1813
## Installation ##
1914

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

20+
## Developer setup ##
21+
22+
This repo contains everything you need to get a test environment setup using the official [WordPress docker image](https://hub.docker.com/_/wordpress).
23+
24+
__Developer dependencies__
25+
26+
* [node.js](https://nodejs.org/) (tested on v20)
27+
* [nvm](https://github.com/nvm-sh/nvm#readme)
28+
* [Docker Desktop](https://www.docker.com/products/docker-desktop)
29+
30+
__Build and start__
31+
32+
./bin/build
33+
./bin/start
34+
35+
__Local website__
36+
37+
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.
38+
39+
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.
40+
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.
41+
42+
__WordPress admin credentials__
43+
44+
Username: `admin`
45+
Password: `password`
46+
47+
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.
48+
2549
## Frequently Asked Questions ##
2650

27-
### A question that someone might have ###
51+
### Did you say there's no tracking? ###
52+
53+
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.
54+
55+
### How do you define a conversion? ###
56+
57+
There are currently two kinds of conversions: **page loads** and **clicks** (on a specific configured element).
2858

29-
An answer to that question.
59+
### Does the plugin handle front-end caching? ###
60+
61+
Yes, the tests will work fine with HTML generated behind a CDN, or using other kinds of front-end caching.
3062

3163
## Screenshots ##
3264

33-
TK
65+
### 1. Split Tests posts page ###
66+
![Split Tests posts page](assets/screenshot-1.png)
67+
68+
### 2. Split Test post editor ###
69+
![Split Test post editor](assets/screenshot-2.png)
70+
71+
### 3. Post Title variants ###
72+
![Post Title variants](assets/screenshot-3.png)
73+
3474

3575
## Changelog ##
3676

37-
### 0.0.1 ###
38-
Split tests for post titles
77+
### 0.0.4 ###
78+
Adds a cron mechanism to combine raw events in the database into daily aggregates
79+
80+
### 0.0.3 ###
81+
Context for where tests run ('all', 'home', or a 'url' pattern)
3982

4083
### 0.0.2 ###
4184
Split tests for DOM changes
4285

43-
### 0.0.3 ###
44-
Context for where tests run ('all', 'home', or a 'url' pattern)
86+
### 0.0.1 ###
87+
Split tests for post titles

assets/screenshot-1.png

295 KB
Loading

assets/screenshot-2.png

305 KB
Loading

assets/screenshot-3.png

228 KB
Loading

bin/build

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ set -o nounset
88
source ~/.nvm/nvm.sh
99
nvm use
1010

11+
if [ ! -f .env ] ; then
12+
echo "Setting up .env ..."
13+
echo
14+
cp .env.sample .env
15+
echo
16+
17+
echo "What is your ACF Pro key?"
18+
read -p "> " ACF_PRO_KEY
19+
echo >> .env
20+
echo "# This is for the ACF Pro installer plugin" >> .env
21+
echo "# See: https://github.com/dphiffer/acf-pro-installer" >> .env
22+
echo "ACF_PRO_KEY=$ACF_PRO_KEY" >> .env
23+
echo
24+
echo "Thank you!"
25+
fi
26+
1127
echo "Building and then starting containers..."
1228
echo
1329
docker compose build

compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ services:
1313
WORDPRESS_CONFIG_EXTRA: |
1414
define('WP_DEBUG_LOG', '/var/log/wordpress.debug.log');
1515
define('WP_DEBUG_DISPLAY', false);
16+
COMPOSER_AUTH: |
17+
{
18+
"http-basic": {
19+
"connect.advancedcustomfields.com": {
20+
"username": "${ACF_PRO_KEY}",
21+
"password": "http://localhost:8080"
22+
}
23+
}
24+
}
25+
ACF_PRO_KEY: ${ACF_PRO_KEY}
1626
volumes:
1727
- .:/var/www/html/wp-content/plugins/split-tests
1828
db:

0 commit comments

Comments
 (0)