Skip to content

Commit 64083d6

Browse files
committed
Only include Google Analytics markup if an account has been entered
1 parent f521f8a commit 64083d6

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

_includes/analytics.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
<!-- Google Analytics -->
2-
<script type="text/javascript">
1+
{% if site.google_analytics %}
2+
<!-- Google Analytics -->
3+
<script type="text/javascript">
34

4-
var _gaq = _gaq || [];
5-
_gaq.push(['_setAccount', '{{ site.google_analytics }}']);
6-
_gaq.push(['_trackPageview']);
5+
var _gaq = _gaq || [];
6+
_gaq.push(['_setAccount', '{{ site.google_analytics }}']);
7+
_gaq.push(['_trackPageview']);
78

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-
})();
9+
(function() {
10+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
11+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
12+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
13+
})();
1314

14-
</script>
15+
</script>
16+
{% endif %}

0 commit comments

Comments
 (0)