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
A/B testing enables you to experiment with design and functionality variants of your application. The data generated will allow you to make modifications to your app, safe in the knowledge that it will have a net positive effect.
7
+
:::tip
8
8
9
-
You can use Flagsmith to perform A/B tests. Using a combination of [multivariate flags](/managing-flags/core-management) and a 3rd party analytics tool like [Amplitude](https://amplitude.com/) or [Mixpanel](https://mixpanel.com/), you can easily perform complex A/B tests that will help improve your product.
9
+
Flagsmith now runs experiments natively, with a managed warehouse and built-in statistics: see the
10
+
[Experimentation overview](/experimentation/). This guide covers the do-it-yourself approach with a third-party
11
+
analytics platform.
10
12
11
-
Running A/B tests require two main components: a bucketing engine and an analytics platform. The bucketing engine is used to put users into a particular A/B testing bucket. These buckets will control the specific user experience that is being tested. The analytics platform will receive a stream of event data derived from the behaviour of the user. Combining these two concepts allows you to deliver seamless A/B test.
13
+
:::
12
14
13
-
We have [integrations](/third-party-integrations/analytics/segment) with a number of analytics platforms. If we don't integrate with the platform you are using, you can still manually send the test data to the downstream platform manually.
15
+
A/B testing enables you to experiment with design and functionality variants of your application. The data generated
16
+
will allow you to make modifications to your app, safe in the knowledge that it will have a net positive effect.
17
+
18
+
You can use Flagsmith to perform A/B tests. Using a combination of [multivariate flags](/managing-flags/core-management)
19
+
and a 3rd party analytics tool like [Amplitude](https://amplitude.com/) or [Mixpanel](https://mixpanel.com/), you can
20
+
easily perform complex A/B tests that will help improve your product.
21
+
22
+
Running A/B tests require two main components: a bucketing engine and an analytics platform. The bucketing engine is
23
+
used to put users into a particular A/B testing bucket. These buckets will control the specific user experience that is
24
+
being tested. The analytics platform will receive a stream of event data derived from the behaviour of the user.
25
+
Combining these two concepts allows you to deliver seamless A/B test.
26
+
27
+
We have [integrations](/third-party-integrations/analytics/segment) with a number of analytics platforms. If we don't
28
+
integrate with the platform you are using, you can still manually send the test data to the downstream platform
29
+
manually.
14
30
15
31
By the end of this tutorial, you will be able to:
16
32
17
-
-Set up a multivariate flag in Flagsmith for A/B testing.
18
-
-Implement logic in your application to bucket users and display variants.
19
-
-Send A/B test data to an analytics platform.
20
-
-Understand how to use anonymous identities for A/B testing on unknown users.
33
+
- Set up a multivariate flag in Flagsmith for A/B testing.
34
+
- Implement logic in your application to bucket users and display variants.
35
+
- Send A/B test data to an analytics platform.
36
+
- Understand how to use anonymous identities for A/B testing on unknown users.
21
37
22
38
## Before you begin
23
39
24
40
To follow this tutorial, you will need:
25
41
26
-
- A basic understanding of [multivariate flags](/managing-flags/core-management) in Flagsmith. Remember: multivariate bucketing only works when users are identified (use real identities or persistent anonymous GUIDs).
27
-
- Access to a third-party analytics platform (e.g., Amplitude, Mixpanel) where you can send custom events. You can explore Flagsmith [integrations](/third-party-integrations/analytics/segment) for this purpose.
42
+
- A basic understanding of [multivariate flags](/managing-flags/core-management) in Flagsmith. Remember: multivariate
43
+
bucketing only works when users are identified (use real identities or persistent anonymous GUIDs).
44
+
- Access to a third-party analytics platform (e.g., Amplitude, Mixpanel) where you can send custom events. You can
45
+
explore Flagsmith [integrations](/third-party-integrations/analytics/segment) for this purpose.
28
46
- A development environment for your application where you can implement changes and integrate the Flagsmith SDK.
29
47
30
48
## Scenario - Testing a new Paypal button
31
49
32
-
For this example, lets assume we have an app that currently accepts credit card payments only. We have a hunch that we are losing out on potential customers that would like to pay with PayPal. We're going to test whether adding PayPal to the payment options increases our checkout rate.
50
+
For this example, lets assume we have an app that currently accepts credit card payments only. We have a hunch that we
51
+
are losing out on potential customers that would like to pay with PayPal. We're going to test whether adding PayPal to
52
+
the payment options increases our checkout rate.
33
53
34
-
We have a lot of users on our platform, so we don't want to run this test against our entire user-base. We want 90% of our users to be excluded from the test. Then for our test, 5% of our users will see the new Paypal button, and the remaining 5% will not see it. So we will have 3 buckets:
54
+
We have a lot of users on our platform, so we don't want to run this test against our entire user-base. We want 90% of
55
+
our users to be excluded from the test. Then for our test, 5% of our users will see the new Paypal button, and the
56
+
remaining 5% will not see it. So we will have 3 buckets:
35
57
36
58
1. Excluded (Control) Users
37
59
2. Paypal test button users
38
60
3. Test users that don't see the Paypal button
39
61
40
-
Because Flagsmith flags can contain both boolean states as well as multivariate flag values, we can make use of both. We will use the boolean flag state to control whether to run the test. Then, if the flag is `enabled`, check the multivariate value. In this example, we will only show the PayPal button if the value is set to `show`.
62
+
Because Flagsmith flags can contain both boolean states as well as multivariate flag values, we can make use of both. We
63
+
will use the boolean flag state to control whether to run the test. Then, if the flag is `enabled`, check the
64
+
multivariate value. In this example, we will only show the PayPal button if the value is set to `show`.
41
65
42
66
## Steps
43
67
44
-
1. Create a new [multivariate flag](/managing-flags/core-management) that will control which of the 3 buckets the user is put into. We'll call this flag `paypal_button_test`. We will provide 3 variate options:
68
+
1. Create a new [multivariate flag](/managing-flags/core-management) that will control which of the 3 buckets the user
69
+
is put into. We'll call this flag `paypal_button_test`. We will provide 3 variate options:
45
70
46
71
1. Control - 90% of users
47
72
2. Paypal button - 5% of users
48
73
3. Test users that don't see the Paypal button - 5% of users
49
74
50
-
2. In our app, we want to [identify](/flagsmith-concepts/identities) each user before they start the checkout process. All Flagsmith multivariate flags need us to identify the user, so we can bucket them in a reproducible manner.
51
-
3. When we get to the checkout page, check the `value` of the `paypal_button_test` flag for that user. If it evaluates to `show`, show the PayPal payment button. Otherwise, don't show the button.
52
-
4. Send an event message to the analytics platform, adding the name/value pair of `paypal_button_test` and the value of the flag; in this case it would be one of either `control`, `show` or `hide`.
75
+
2. In our app, we want to [identify](/flagsmith-concepts/identities) each user before they start the checkout process.
76
+
All Flagsmith multivariate flags need us to identify the user, so we can bucket them in a reproducible manner.
77
+
3. When we get to the checkout page, check the `value` of the `paypal_button_test` flag for that user. If it evaluates
78
+
to `show`, show the PayPal payment button. Otherwise, don't show the button.
79
+
4. Send an event message to the analytics platform, adding the name/value pair of `paypal_button_test` and the value of
80
+
the flag; in this case it would be one of either `control`, `show` or `hide`.
53
81
5. Deploy our app, enable the flag and watch the data come in to your analytics platform.
54
82
55
83
Here is what creating the flag would look like.
56
84
57
85

58
86
59
-
Once the test is set up, and the flag has been enabled, data will start streaming into the analytics platform. We can now evaluate the results of the tests based on the behavioral changes that the new button has created.
87
+
Once the test is set up, and the flag has been enabled, data will start streaming into the analytics platform. We can
88
+
now evaluate the results of the tests based on the behavioral changes that the new button has created.
60
89
61
90
## Handling Anonymous/Unknown Identities
62
91
63
-
To do A/B testing you need to use identities. Without an identity to key from, it's impossible for the platform to serve a consistent experience to your users.
92
+
To do A/B testing you need to use identities. Without an identity to key from, it's impossible for the platform to serve
93
+
a consistent experience to your users.
64
94
65
-
What if you want to run an A/B test in an area of your application where you don't know who your users are? For example on the homepage of your website? In this instance, you need to generate _anonymous identities_ values for your users. In this case we will generate a GUID for each user.
95
+
What if you want to run an A/B test in an area of your application where you don't know who your users are? For example
96
+
on the homepage of your website? In this instance, you need to generate _anonymous identities_ values for your users. In
97
+
this case we will generate a GUID for each user.
66
98
67
-
A GUID value is just a random string that has an extremely high likelihood of being unique. There's more info about generating GUID values [on Stack Overflow](https://stackoverflow.com/a/2117523).
99
+
A GUID value is just a random string that has an extremely high likelihood of being unique. There's more info about
0 commit comments