Move Google analytics block to the top

because according to Google:

One of the main advantages of the asynchronous snippet is that you can position it at the top of the HTML document. This increases the likelihood that the tracking beacon will be sent before the user leaves the page. It is customary to place JavaScript code in the section, and we recommend placing the snippet at the bottom of the section for best performance.
This commit is contained in:
vitaut 2015-05-23 11:42:57 -07:00
parent e1fcb0a2b5
commit 9e83b8a6e0

View File

@ -5,6 +5,15 @@
<meta name="keywords" content="C++, formatting, printf, string, library">
<meta name="author" content="Victor Zverovich">
<link rel="stylesheet" href="_static/cppformat.css">
{# Google Analytics #}
<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-20116650-4', 'cppformat.github.io');
ga('send', 'pageview');
</script>
{% endblock %}
{%- macro searchform(classes, button) %}
@ -123,17 +132,6 @@
{% block footer %}
{{ super() }}
{# Placed at the end of the document so the pages load faster. #}
<script src="_static/bootstrap.min.js"></script>
<script>
{# Google Analytics #}
(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-20116650-4', 'cppformat.github.io');
ga('send', 'pageview');
</script>
{% endblock %}