Skip to content

Commit

Permalink
Moved Google Analytics to the include.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rarst committed Jan 12, 2018
1 parent 4e7e458 commit d0efdcd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
16 changes: 16 additions & 0 deletions _includes/google-analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-42622442-1', 'rarst.net');
ga('send', 'pageview');
</script>
23 changes: 4 additions & 19 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,14 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% if page.title and page.frontpage != true %}{{ page.title | escape }} | {% endif %}{{ site.title | escape }}</title>
{%- if page.excerpt %}<meta name="description" content="{{ page.excerpt | strip_html | normalize_whitespace | truncate: 160 | escape }}">{% endif %}
{%- if page.excerpt %}
<meta name="description" content="{{ page.excerpt | strip_html | normalize_whitespace | truncate: 160 | escape }}">
{% endif -%}
<link rel="shortcut icon" href="/favicon.ico" />
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.3.7/readable/bootstrap.min.css" rel="stylesheet">
<link href="/assets/style.css" rel="stylesheet">

{%- if jekyll.environment == 'production' %}
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-42622442-1', 'rarst.net');
ga('send', 'pageview');
</script>
{% endif %}
{%- if jekyll.environment == 'production' %}{% include google-analytics.html %}{% endif %}
</head>
<body>
<nav class="navbar navbar-default navbar-static-top" role="navigation">
Expand Down

0 comments on commit d0efdcd

Please sign in to comment.