Skip to content

Commit 83d0a99

Browse files
authored
Add Yandex.Metrika counter (#4)
1 parent dddfb35 commit 83d0a99

File tree

3 files changed

+50
-24
lines changed

3 files changed

+50
-24
lines changed

_config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ favicon: images/favicon.png
2626
# Google Analytics id, e.g. "UA-NNNNNNNN-N"
2727
google_analytics: "G-3712TB0863"
2828

29+
# Yandex.Metrika counter
30+
yandex_metrika: "99021176"
31+
2932
# Site navigation - each item must have a title and a url.
3033
navigation:
3134
- text: Blogs Home

_includes/yandex_metrika.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Yandex.Metrika counter -->
2+
<script type="text/javascript" >
3+
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
4+
m[i].l=1*new Date();
5+
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
6+
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
7+
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
8+
9+
ym({{ site.yandex_metrika }}, "init", {
10+
clickmap:true,
11+
trackLinks:true,
12+
accurateTrackBounce:true
13+
});
14+
</script>
15+
<noscript><div><img src="https://mc.yandex.ru/watch/{{ site.yandex_metrika }}" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
16+
<!-- /Yandex.Metrika counter -->

_layouts/default.html

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,43 @@
11
<!DOCTYPE html>
22
<html lang="{{ site.lang | default: 'en-US' }}">
33
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
7-
<meta name="description" content="{{ page.description | default: site.description | strip_html | normalize_whitespace | truncate: 160 | escape }}">
8-
<link rel="canonical" href="{{ page.url | replace:'index.html', '' | absolute_url }}">
9-
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }} Feed"
10-
href="{{ '/feed.xml' | absolute_url }}">
11-
{% if site.favicon and site.favicon != "" %}
12-
<link rel="shortcut icon" href="{{ site.favicon | relative_url }}" type="image/png" />
13-
{% endif %}
14-
<!-- Styles -->
15-
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i%7CNoto+Serif:400,400i,700,700i&display=swap" rel="stylesheet">
16-
<link href="{{ '/assets/css/style.css' | relative_url }}" rel="stylesheet">
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
7+
<meta name="description"
8+
content="{{ page.description | default: site.description | strip_html | normalize_whitespace | truncate: 160 | escape }}">
9+
<link rel="canonical" href="{{ page.url | replace:'index.html', '' | absolute_url }}">
10+
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }} Feed"
11+
href="{{ '/feed.xml' | absolute_url }}">
12+
{% if site.favicon and site.favicon != "" %}
13+
<link rel="shortcut icon" href="{{ site.favicon | relative_url }}" type="image/png"/>
14+
{% endif %}
15+
<!-- Styles -->
16+
<link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i%7CNoto+Serif:400,400i,700,700i&display=swap"
17+
rel="stylesheet">
18+
<link href="{{ '/assets/css/style.css' | relative_url }}" rel="stylesheet">
1719
</head>
1820
<body>
1921

20-
<div id="page" class="site">
22+
<div id="page" class="site">
2123
<div class="inner">
22-
{% include header.html %}
23-
{{content}}
24-
{% include footer.html %}
24+
{% include header.html %}
25+
{{content}}
26+
{% include footer.html %}
2527
</div><!-- .inner -->
26-
</div><!-- .site -->
28+
</div><!-- .site -->
2729

28-
<!-- Scripts -->
29-
{% if site.google_analytics %}
30-
{% include google_analytics.html %}
31-
{% endif %}
32-
<script src="{{ '/assets/js/plugins.js' | relative_url }}"></script>
33-
<script src="{{ '/assets/js/custom.js' | relative_url }}"></script>
30+
<!-- Scripts -->
31+
<script src="{{ '/assets/js/plugins.js' | relative_url }}"></script>
32+
<script src="{{ '/assets/js/custom.js' | relative_url }}"></script>
33+
34+
{% if site.google_analytics %}
35+
{% include google_analytics.html %}
36+
{% endif %}
37+
38+
{% if site.yandex_metrika %}
39+
{% include yandex_metrika.html %}
40+
{% endif %}
3441

3542
</body>
3643
</html>

0 commit comments

Comments
 (0)