Integrate Convert Experiences with Yandex

Convert-Yandex Metrica Integration

Integration of Yandex Metrica with Convert Experiences will help you to import Convert data into your Yandex Metrica account. 

For each experiment, the integration can pass along the experiment name and variation name that the visitor is currently bucketed into (if any).

Create Yandex Metrica Counter for your Site

Create your own Yandex Metrica counter for your page. 

Add Tracking Code Snippets

Make sure the Convert tracking code is installed on your page.

You should also add the Yandex counter code to the HTML code of all site pages. It is preferable to insert the code closer to the top of the page, as it will load faster. If you have already inserted counter code on a site, and then changed the counter settings, then you must renew the counter code on all site pages. Yandex counter code look like this:

Send User/Session Parameters

Then modify the counter code above and send your Convert data (e.g. Experiment and Variation names) to your Yandex counter number through user or session parameters, e.g.

(function (d, w, c) {
        (w[c] = w[c] || []).push(function() {
            try {
                
                var refObject = window['convert']['data']['experiments']
					for (var key in window["convert"]["currentData"]["experiments"]) {
						if (!window["convert"]["currentData"]["experiments"].hasOwnProperty(key)) {
						continue;
				}}
            
				var currentExperiment = window["convert"]["currentData"]["experiments"][key];
				var curExperimentName = refObject[key] && refObject[key].n ? refObject[key].n : "unknown experiment name";
				curExperimentName = curExperimentName.replace("Test #", "Test ");
				var curVariant = currentExperiment['variation_name'] ? currentExperiment['variation_name'] : "unknown variant";
				curVariant = curVariant.replace("Var #", "Variation ");
                                
                
                  w.yaCounter47282985 = new Ya.Metrika({
                    id:47282985,
                    clickmap:true,
                    trackLinks:true,
                    accurateTrackBounce:true,
                    params: {
                        x: 12,
                        y: "user2"},
                    userParams: {
                        exp_name: curExperimentName,
                        var_name: curVariant}
                });
            } catch(e) { }
        });

        var n = d.getElementsByTagName("script")[0],
            s = d.createElement("script"),
            f = function () { n.parentNode.insertBefore(s, n); };
        s.type = "text/javascript";
        s.async = true;
        s.src = "https://mc.yandex.ru/metrika/watch.js";

        if (w.opera == "[object Opera]") {
            d.addEventListener("DOMContentLoaded", f, false);
        } else { f(); }
    })(document, window, "yandex_metrika_callbacks");

View Convert Data in Yandex Metrica Reports

In order to see the data sent, you must login into your Yandex Metrica account and go to Reports > Standard reports > Content > User or Session parameters

Troubleshoot

To check whether the counter code was installed and set up correctly, use the _ym_debug=1 parameter. For more information, see Creating and installing a counter.

Have more questions? Submit a request

Comments