Skip to content

Commit f01a0d0

Browse files
committed
chore: add Google Analytics tag
1 parent 96a8d05 commit f01a0d0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ theme: jekyll-theme-hacker
3535
plugins:
3636
- jekyll-feed
3737

38+
google_analytics: "G-WZE3Q1HC4G"
39+
3840
# Exclude from processing.
3941
# The following items will not be processed, by default.
4042
# Any item listed under the `exclude:` key here will be automatically added to
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{% if site.google_analytics %}
2+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
3+
<script>
4+
window.dataLayer = window.dataLayer || [];
5+
function gtag(){dataLayer.push(arguments);}
6+
gtag('js', new Date());
7+
8+
gtag('config', '{{ site.google_analytics }}');
9+
</script>
10+
{% endif %}

0 commit comments

Comments
 (0)