Skip to content

Commit 4a3c2a9

Browse files
authored
Enable Google Analytics (#11)
* Enable Google Analytics * Use variable for tag
1 parent bbd099b commit 4a3c2a9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ baseurl: "" # the subpath of your site, e.g. /blog
2626
url: "https://blog.playcanvas.com/" # the base hostname & protocol for your site, e.g. http://example.com
2727
twitter_username: playcanvas
2828
github_username: playcanvas
29+
google_analytics: G-NDG04ENSGD
2930

3031
# Build settings
3132
theme: minima

_includes/google-analytics.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- Google tag (gtag.js) -->
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>

0 commit comments

Comments
 (0)