Skip to content

Commit 292293e

Browse files
committed
Google Analytics
1 parent 1ebace0 commit 292293e

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ collapse_inactive_chapters: true
6363

6464
# Enable copy code button
6565
enable_copy_code_button: true
66+
67+
# Google Analytics
68+
ga_tracking: G-BJBJ6TYVWF # Replace with your actual Google Analytics tracking ID
69+
ga_tracking_anonymize_ip: true

docs/_layouts/default.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55
<!DOCTYPE html>
66

77
<html lang="{{ site.lang | default: 'en-US' }}">
8-
{% include head.html %}
8+
<head>
9+
{% include head.html %}
10+
<!-- Google Analytics tracking code -->
11+
{% if site.ga_tracking != nil %}
12+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.ga_tracking }}"></script>
13+
<script>
14+
window.dataLayer = window.dataLayer || [];
15+
function gtag(){dataLayer.push(arguments);}
16+
gtag('js', new Date());
17+
gtag('config', '{{ site.ga_tracking }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
18+
</script>
19+
{% endif %}
20+
</head>
921
<body>
1022
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
1123
<symbol id="svg-link" viewBox="0 0 24 24">
1224
<title>Link</title>
1325
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-link">
14-
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
26+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0-7.07 7.07l1.71-1.71"></path>
1527
</svg>
1628
</symbol>
1729
<symbol id="svg-search" viewBox="0 0 24 24">

docs/google-site-verification.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
layout: null
3+
permalink: /google12345.html
4+
---
5+
google-site-verification: google12345.html

0 commit comments

Comments
 (0)