Making things right with JS and CSS headers
authorSébastien CHAZALLET <s.chazallet@gmail.com>
Wed, 10 Dec 2014 11:25:59 +0000 (12:25 +0100)
committerSébastien CHAZALLET <s.chazallet@gmail.com>
Wed, 10 Dec 2014 11:25:59 +0000 (12:25 +0100)
addons/website/views/website_templates.xml

index 917fd0a..9f9c653 100644 (file)
             <t t-call-assets="web.assets_common" t-js="false"/>
             <t t-call-assets="website.assets_frontend" t-js="false"/>
 
+            <t t-call-assets="web.assets_common" t-css="false"/>
+            <t t-call-assets="website.assets_frontend" t-css="false"/>
+            <script t-if="website and website.google_analytics_key">
+                (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', _.str.trim('<t t-esc="website.google_analytics_key"/>'), 'auto');
+                ga('send','pageview');
+            </script>
+
             <t t-raw="head or ''" name='layout_head'/>
         </head>
         <body>
                     </div>
                 </footer>
             </div>
-
-            <t t-call-assets="web.assets_common" t-css="false"/>
-            <t t-call-assets="website.assets_frontend" t-css="false"/>
-            <script t-if="website and website.google_analytics_key">
-                (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', _.str.trim('<t t-esc="website.google_analytics_key"/>'), 'auto');
-                ga('send','pageview');
-            </script>
         </body>
     </html>
 </template>