Skip to content

Commit f83a136

Browse files
added google analytics tracking 2
1 parent 84cc9c5 commit f83a136

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

_layouts/default.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
<!DOCTYPE html>
22
<html lang="{{ site.lang | default: "en-US" }}">
33
<head>
4-
<meta charset="UTF-8">
4+
{% if site.google_analytics %}
5+
<!-- Global Site Tag (gtag.js) - Google Analytics -->
6+
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-107694606-1"></script>
7+
<script>
8+
window.dataLayer = window.dataLayer || [];
9+
function gtag(){dataLayer.push(arguments);}
10+
gtag('js', new Date());
11+
12+
gtag('config', 'UA-107694606-1');
13+
</script>
14+
{% endif %} <meta charset="UTF-8">
515

616
{% seo %}
717
<meta name="description" content="{{ page.description | default: site.description | default: site.github.project_tagline }}"/>
@@ -35,16 +45,6 @@ <h2 class="project-tagline">{{ site.description | default: site.github.project_t
3545
</footer>
3646
</section>
3747

38-
{% if site.google_analytics %}
39-
<script type="text/javascript">
40-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
41-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
42-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
43-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
4448

45-
ga('create', '{{ site.google_analytics }}', 'auto');
46-
ga('send', 'pageview');
47-
</script>
48-
{% endif %}
4949
</body>
5050
</html>

0 commit comments

Comments
 (0)