Skip to content

Commit 37c4d5e

Browse files
committed
place google analytics in <head>
1 parent ce64bb1 commit 37c4d5e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

themes/vue/layout/layout.ejs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,17 @@
2828
<!-- this needs to be loaded before guide's inline scripts -->
2929
<script src="/js/vue.js"></script>
3030
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
31+
32+
<!-- ga -->
33+
<script>
34+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
35+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
36+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
37+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
38+
39+
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
40+
ga('send', 'pageview');
41+
</script>
3142
</head>
3243
<body class="<%- isIndex ? '' : 'docs' -%>">
3344
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>
@@ -51,17 +62,6 @@
5162
<!-- main custom script for sidebars, version selects etc. -->
5263
<script src="/js/common.js"></script>
5364

54-
<!-- ga -->
55-
<script>
56-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
57-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
58-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
59-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
60-
61-
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
62-
ga('send', 'pageview');
63-
</script>
64-
6565
<!-- search -->
6666
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
6767
<%- css('css/search') %>

0 commit comments

Comments
 (0)