Sometimes, you might want to launch a test after a user completes a certain action on your site, for example after they have clicked a certain button, or after they have spent a certain length of time on a given page.
The function takes the following form:
ABTastyStartTest(testID); // where testID is the ID of the test to be launched
This function must be called as soon as each visitor has completed the action on which the test is conditioned. Note: the tested page must be the page on which the action takes place (you cannot test modifications on another page).
To create a test conditioned on an event, you must:
1) Create a standard test, applying your desired modifications
2) Tick the checkbox "Target by event" in the targeting options window, in the same box as the URL targeting options. Note that other targeting options will no longer be available
3) Set up the rest of your test as usual
4) Launch your test
5) Call the function ABTastyStartTest directly from your application whenever the event occurs.
For example, if you would like test 12345 (set up in advance) to be triggered by a click on a button, you can do this in the following way:
<button onclick='ABTastyStartTest(12345)'>Launch a test from this button</button>
You can use any other method which links this function to an event. For example, you could use jQuery, or a callback function might be used if your site uses AJAX.