Skip to content

Commit 620da43

Browse files
committed
Add analytics tracking.
1 parent e4bb52a commit 620da43

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

_data/theme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ email: [email protected]
2626
tagline: "what's a tagline?"
2727

2828
# Google Analytics key, leave blank to ignore
29-
google_analytics_key:
29+
google_analytics_key: UA-77784061-1
3030

3131
# Toggle "Postings are my own" disclaimer in footer
3232
show_disclaimer: false

_includes/analytics.html

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{% if site.data.theme.google_analytics_key %}
2-
<script type="text/javascript">
3-
4-
var _gaq = _gaq || [];
5-
_gaq.push(['_setAccount', '{{ site.data.theme.google_analytics_key }}']);
6-
_gaq.push(['_trackPageview']);
7-
8-
(function() {
9-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
10-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
11-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
12-
})();
2+
<script>
3+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
7+
8+
ga('create', 'UA-77784061-1', 'auto');
9+
ga('send', 'pageview');
1310

1411
</script>
15-
{% endif %}
12+
{% endif %}

_layouts/default.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
<link rel="stylesheet" href="/assets/css/all.css">
1919
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha256-k2/8zcNbxVIh5mnQ52A0r3a6jAgMGxFJFE2707UxGCk= sha512-ZV9KawG2Legkwp3nAlxLIVFudTauWuBpC10uEafMHYL0Sarrz5A7G79kXh5+5+woxQ5HM559XX2UZjMJ36Wplg==" crossorigin="anonymous">
20+
21+
{% include analytics.html %}
22+
2023
</head>
2124
<body>
2225
<div class="container">
@@ -33,6 +36,5 @@
3336
</div>
3437
</div>
3538

36-
{% include analytics.html %}
3739
</body>
3840
</html>

0 commit comments

Comments
 (0)