Skip to content

Commit a843183

Browse files
committed
Add Google Analytics.
1 parent 6f2cf72 commit a843183

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,20 @@ <h3 class="space-lg">IDE integration</h3>
128128
</div>
129129
</body>
130130

131+
<!-- Global site tag (gtag.js) - Google Analytics -->
132+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2T4F5GFLP5"></script>
133+
<script>
134+
var localAddrs = ["localhost", "127.0.0.1", ""];
135+
136+
// make sure we don't activate google analytics if the developer is
137+
// inspecting the book locally...
138+
if (localAddrs.indexOf(document.location.hostname) === -1) {
139+
window.dataLayer = window.dataLayer || [];
140+
function gtag() { dataLayer.push(arguments); }
141+
gtag('js', new Date());
142+
143+
gtag('config', 'G-2T4F5GFLP5');
144+
}
145+
</script>
146+
131147
</html>

0 commit comments

Comments
 (0)