Skip to content

Commit

Permalink
Only include Google Analytics markup if an account has been entered
Browse files Browse the repository at this point in the history
  • Loading branch information
barryclark committed May 28, 2014
1 parent f521f8a commit 64083d6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<!-- Google Analytics -->
<script type="text/javascript">
{% if site.google_analytics %}
<!-- Google Analytics -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.google_analytics }}']);
_gaq.push(['_trackPageview']);
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ site.google_analytics }}']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
</script>
{% endif %}

0 comments on commit 64083d6

Please sign in to comment.