Example. AB testing

Let’s say we need to conduct an experiment to determine how the color of the Buy button affects the conversion rate for a “View basket” goal.

If the user is shown a red button, we use the following parameter:

var yaParams = {ab_test: "red button"};

If the user is shown a green button, we use the following parameter:

var yaParams = {ab_test: "green button"};

This parameter is transmitted in any convenient way. For example, it can be passed when initializing the tag on product pages or using the reachGoal method that is called when the Buy button is clicked.

After this, we will be able to use the ab_test parameter value in the Yandex.Metrica interface for selecting the corresponding data.

Example. Registered and non-registered users report

Use the following code sample to analyze differences in the behavior of registered and non-registered site users: