www
www copied to clipboard
feat: A/B testing using wagtail-ab-testing
Fixes https://github.com/ietf-tools/wagtail_website/issues/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.
@ghwood wagtail-ab-testing can track two flavours of goal:
- User lands on a page and optionally performs a specific action (e.g. click on an outbound link, or make a donation).
- 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.
Hi @ghwood, @kesara, just wanted to check in to see if I can help unblock this PR?
@mgax, Thanks. I'm just waiting until we get the current infrastructure move complete.