Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: A/B testing using wagtail-ab-testing #369

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mgax
Copy link
Contributor

@mgax mgax commented Dec 18, 2023

Fixes #173 by implementing wagtail-ab-testing. Adds the ability to track four types of goals:

  • Visit page: user visits a page of the website (this is the built-in goal of wagtail-ab-testing).
  • Navigate to registration website: user clicks a link whose URL begins with https://www.ietf.org/mailman/listinfo/.
  • Navigate to Mailman website: user clicks a link whose URL begins with https://registration.ietf.org.
  • Submit donation form: user submits the PayPal donation form.

For the Submit donation form goal type, for tracking to work, a line of code needs to be added in the page editor, to the Raw html block which contains the donation form: wagtailAbTesting.triggerEvent("submit-donation-form"). It should be added at the end of the onApprove callback.

diff --git a/raw.html b/raw.html
index e26e6d2..38c2bce 100644
--- a/raw.html
+++ b/raw.html
@@ -362,6 +362,7 @@ function loadAndRender(transactionType) {
               // alert('Transaction completed by ' + details.payer.name.given_name);
               // alert('Order ID ' + details.id);
               thankYou(details);
+              wagtailAbTesting.triggerEvent("submit-donation-form");
             });
           },
           onError: (err) => {

Additionally, to show the right page version to visitors (control or variant), a Cloudflare worker needs to be set up.

@mgax
Copy link
Contributor Author

mgax commented Dec 18, 2023

@ghwood wagtail-ab-testing can track two flavours of goal:

  1. User lands on a page and optionally performs a specific action (e.g. click on an outbound link, or make a donation).
  2. User performs an action on any page.

In this PR I've implemented all goals as type "1", i.e. when you set up an experiment, you always need to select a target page. Would it make sense to have some of the goal types be independent of the page? I'm thinking perhaps of the donation goal.

Please note that a goal type can only be page-specific or page-agnostic; if you'd like to have both, then we'd implement it as two different goal types.

@mgax mgax marked this pull request as ready for review December 19, 2023 10:35
@mgax
Copy link
Contributor Author

mgax commented Mar 5, 2024

Hi @ghwood, @kesara, just wanted to check in to see if I can help unblock this PR?

@kesara
Copy link
Member

kesara commented Mar 5, 2024

@mgax, Thanks. I'm just waiting until we get the current infrastructure move complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add A/B testing capability
2 participants