Skip to content

Commit 6b08141

Browse files
committed
docs: change GA code position
1 parent bd84899 commit 6b08141

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

docs/_layouts/default.html

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<!DOCTYPE html>
22
<html lang="en-us">
33
<head>
4+
{% if site.google_analytics %}
5+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
6+
<script>
7+
window.dataLayer = window.dataLayer || [];
8+
function gtag(){dataLayer.push(arguments);}
9+
gtag('js', new Date());
10+
11+
gtag('config', '{{ site.google_analytics }}');
12+
</script>
13+
{% endif %}
414
<meta charset="UTF-8">
515
<title>{{ page.title | default: site.title }}</title>
616
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -125,16 +135,5 @@ <h2 class="project-tagline">{{ site.description | default: site.github.project_t
125135
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
126136
</footer>
127137
</section>
128-
129-
{% if site.google_analytics %}
130-
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
131-
<script>
132-
window.dataLayer = window.dataLayer || [];
133-
function gtag(){dataLayer.push(arguments);}
134-
gtag('js', new Date());
135-
136-
gtag('config', '{{ site.google_analytics }}');
137-
</script>
138-
{% endif %}
139138
</body>
140139
</html>

0 commit comments

Comments
 (0)