Answer the question
In order to leave comments, you need to log in
How to insert the Yandex.Metrica code into a react component?
The question is:
How to insert the Yandex.Metrica code into a react component, which in turn is rendered on the server on top of the meteor OO
In general, we have a meteor application on the backend, a frontend on react, which is rendered on the server via FlowRouter. I don't think it matters, but still. Tell me how you can insert without resorting to npm or what to read?
Answer the question
In order to leave comments, you need to log in
I asked the question myself, got an answer, which I already tried, tried again, everything worked out.
Well, in general, everything is simple, maybe it will be useful to someone:
ym() {
return (
"<script src='https://mc.yandex.ru/metrika/watch.js' type='text/javascript'></script>\
<script type='text/javascript'>\
try {\
var yaCounterXXXXX = new Ya.Metrika({\
id:XXXXX,\
clickmap:true,\
trackLinks:true,\
accurateTrackBounce:true,\
webvisor:true,\
trackHash:true\
});\
} catch(e) { }\
</script>"
);
},
<div dangerouslySetInnerHTML={{__html: this.ym()}}/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question