6
6
6epcepk2019-08-23 13:08:31
Yandex.Metrica
6epcepk, 2019-08-23 13:08:31

Yandex Metrika and AJAX site: how to display an informer?

Good afternoon.

How to display the informer when initializing the metric in this way?

(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(ХХХ, "init", {});


Thank you.

UPD
Here are some crutches (you never know who will come in handy) on jQuery:
$('div').html('<a href="https://metrika.yandex.ru/stat/?id=XXX&amp;from=informer" rel="nofollow"><img src="https://informer.yandex.ru/informer/XXX/3_0_FFFFFFFF_EFEFEFFF_0_pageviews" alt="Яндекс.Метрика" class="ym-advanced-informer" data-cid="XXX" data-lang="ru" /></a>');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konst57, 2019-09-19
@Konst57

You can write a small js script that will add the metric counter code after the page is loaded.
Learn how to delay loading external scripts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question