Skip to content

Commit

Permalink
track google analytics stats
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitadurasov committed Apr 10, 2024
1 parent ba27f8f commit 438792a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion _data/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ instagram-profile: # Add instagram username

#-------------------------------
# Google Analytics
google-analytics: # Add your identifier. For example UA-99631805-1.
google-analytics: G-K030LBEXTB # Add your identifier. For example UA-99631805-1.


#-------------------------------
Expand Down
14 changes: 7 additions & 7 deletions _includes/google-analytics.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.data.settings.google-analytics }}"></script>
<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','https://www.google-analytics.com/analytics.js','ga');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

ga('create', '{{ site.data.settings.google-analytics }}', 'auto');
ga('send', 'pageview');
</script>
gtag('config', '{{ site.data.settings.google-analytics }}');
</script>
4 changes: 2 additions & 2 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

<body>

<!-- {% if site.data.settings.google-analytics %}
{% if site.data.settings.google-analytics %}
{% include google-analytics.html %}
{% endif %} -->
{% endif %}

<!-- begin content -->
<main class="content" aria-label="Content" style="margin-top: 50px;">
Expand Down

0 comments on commit 438792a

Please sign in to comment.