Answer the question
In order to leave comments, you need to log in
How to set up Yandex.Metrica for A/B testing?
Good evening.
Has anyone tried using Yandex.Metrica to conduct A/B testing?
Yandex has a modest instruction about this - help.yandex.ru/metrika/content/visit-params.xml following which I compiled a code similar to the example for 2 landing pages:
<script type="text/javascript">
var yaParams = {ab_test: var_1};
var yaCounter123456 = new Ya.Metrika({id: 123456, params:window.yaParams});
yaCounter123456.params(yaParams);
</script>
where you change only the var_1/var_2 parameter for one and the other pages. <script "type=text/javascript">var random = Math.random();if (random >= '0.5') {var rand = 1;}else {var rand = 2;};var ab_cookie = getCookie('ab_cookie');switch (ab_cookie) {case 'a':break;case 'b':redirectToB();break;default:if(rand == 1) {setCookie('ab_cookie', 'a', 3);}else {setCookie('ab_cookie', 'b', 3);redirectToB();}}function redirectToB() {window.location = “site.ru/index2.html”;}function setCookie(c_name, value, exdays) {var exdate = new Date();exdate.setDate(exdate.getDate() + exdays);var c_value = encodeURI(value) +((exdays == null) ? "" : ("; expires=" + exdate.toUTCString()));document.cookie = c_name + "=" + c_value;}function getCookie(c_name) {var i, x, y, ARRcookies = document.cookie.split(";");for (i = 0; i < ARRcookies.length; i++) {x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);x = x.replace(/^s+|s+$/g, "");if (x == c_name) {return decodeURI(y);}}}</script>
Answer the question
In order to leave comments, you need to log in
Because visit parameters are visit parameters. A universal thing that can be used , including for tests.
View reports either in the "visit parameters" report, or select the traffic where the visit parameters are set through the report constructs.
Or, in metric 2.0, make segments according to the corresponding parameters of visits, and see all the data there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question