Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

Commit f61c48d

Browse files
author
Josh Habdas
committed
feat(layouts): add google analytics
adds google analytics tracking using the async tracking snippet closes speedtracker#57
1 parent afe97c2 commit f61c48d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ host: 0.0.0.0
44

55
version: 1.2.1
66

7+
google_analytics_key: ""
8+
79
exclude:
810
- app
911
- node_modules

_layouts/base.html

+9
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
<head>
1515
{% include meta.html %}
1616

17+
{% if jekyll.environment == 'production' and site.google_analytics_key != '' %}
18+
<script>
19+
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
20+
ga('create', '{{ site.google_analytics_key }}', 'auto');
21+
ga('send', 'pageview');
22+
</script>
23+
<script async src='https://www.google-analytics.com/analytics.js'></script>
24+
{% endif %}
25+
1726
<link rel="stylesheet" type="text/css" href="{{ baseUrl }}/css/main.css?v={{ site.version }}">
1827
</head>
1928
<body>

0 commit comments

Comments
 (0)