Tutorial: Creating your first testΒΆ

When you want to participate a user to a test, you can call Musketeer(‘test’, testName, variants, [options], [callback]). This creates a test and participates the user to the test.

1
2
3
4
5
6
7
8
Musketeer('test', 'MyFirstTest', ['A', 'B'], function (variant) {
        if (variant === 'A') {
                // The user is participating variant A.
        }
        else if (variant === 'B') {
                // The user is participating variant B.
        }
});

Now, in a test you want the user to convert, sign up for a newsletter or perform a checkout. Once this happens, you need to call Musketeer(‘convert’, testName) to let Musketeer know the user converted.

1
Musketeer('convert', 'MyFirstTest');

Please have a look at the JavaScript API reference to read more about the complete JavaScript API.