Answer the question
In order to leave comments, you need to log in
How to send data to Yandex.Metrica e-commerce?
I understand correctly that first in the js code goes:
window.dataLayer.push({
"ecommerce": {
"currencyCode": "RUB",
"detail": {
"products": [
{
"id": "12342",
"name" : presidentName,
"price": 60.00,
"brand": "",
"category": chooseStr,
"variant" : ""
}
]
}
}
});
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(6453123476, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true,
ecommerce:"dataLayer"
});
Answer the question
In order to leave comments, you need to log in
No, it's wrong. You have window.dataLayer before connecting Metrica is not defined.
E-commerce events are called after Metrica is connected, and not by themselves, but in response to specific user actions (viewing a product, removing it from the cart, buying, and others, as described in the documentation).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question