You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-67Lines changed: 28 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,20 +90,13 @@ Finally, add the tracking script to your base HTML template:
90
90
91
91
## Goal events
92
92
93
-
Each A/B test has a goal that is measured after a user visits the page that the A/B test is running on.
93
+
## Implementing custom goal event types
94
94
95
-
The goal is defined by a destination page and and event type. For example, if the A/B test needs to measure how a change on the page affects the number of users who go on to submit a "Contact us" form, then the 'destination page' would be the "Contact us" page and the 'event type' would be "Submit form".
96
-
97
-
Out of the box, the only 'event type' that Wagtail A/B testing supports is visiting the destination page.
98
-
If you need to measure something else (such as submitting a form, purchasing something, or just clicking a link), you can implement a custom 'event type'.
99
-
100
-
### Implementing a custom goal event type
101
-
102
-
Custom event types are implemented for specific types of destination page.
103
-
104
-
Firstly, you need to register the 'event type' using the `register_ab_testing_event_types` hook,
105
-
this displays the goal 'event type' in the list of options when an A/B test is being created:
95
+
Out of the box, Wagtail A/B testing provides a "Visit page" goal event type which you can use to track when users visit a goal page.
96
+
It also supports custom goal types, which can be used for tracking other events such as making a purchase, submitting a form, or clicking a link.
106
97
98
+
To implement a custom goal event type, firstly register your type using the ``register_ab_testing_event_types`` hook, this would
99
+
add your goal type to the list of options shown to users when they create A/B tests:
The JavaScript library tracks A/B tests using ``localStorage``, so this will only call the server if the user is participating in an A/B test with the provided goal type and the current page is the goal page.
138
+
157
139
#### Example: Adding a "Submit form" event type
158
140
159
-
In this example, we will add a "Submit form" event type for a ``ContactUsFormPage`` page type.
141
+
We will add a "Submit form" event type for a ``ContactUsFormPage`` page type in this example.
160
142
161
143
Firstly, we need to register the event type. To do this, implement a handler for the ``register_ab_testing_event_types`` hook in your app:
0 commit comments