gitbook-plugin-yametrika
Version:
Yandex Metrika tracking for your gitbook
33 lines (31 loc) • 1.23 kB
HTML
{% extends template.self %}
{% block javascript %}
{{ super() }}
<script type='text/javascript'>
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter{{ config.pluginsConfig.yametrika.id }} = new Ya.Metrika({{ config.pluginsConfig.yametrika|dump|safe }});
} 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 = (d.location.protocol == 'https:' ? 'https:' : 'http:') + '//mc.yandex.ru/metrika/watch.js';
if (w.opera == '[object Opera]') {
d.addEventListener('DOMContentLoaded', f, false);
} else {
f();
}
})(document, window, 'yandex_metrika_callbacks');
</script>
<noscript>
<div>
<img src="//mc.yandex.ru/watch/{{ config.pluginsConfig.yametrika.id }}" style="position:absolute; left:-9999px;" alt=""/>
</div>
</noscript>
{% endblock %}