Skip to content

Commit 0c6878d

Browse files
authored
Add Google Analytics tag (#153)
1 parent ab5e32f commit 0c6878d

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

tutorial/tutorial_sphinx_theme_1/layout.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,12 @@
631631
{%- if theme_analytics_id %}
632632
<!-- Theme Analytics -->
633633
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script>
634-
<script></script>
634+
<script>
635+
window.dataLayer = window.dataLayer || [];
636+
function gtag(){dataLayer.push(arguments);}
637+
gtag('js', new Date());
638+
gtag('config', '{{ theme_analytics_id }}');
639+
</script>
635640

636641
{%- endif %}
637642
{%- endif %}

tutorial/tutorial_sphinx_theme_1/theme.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pygments_style = default
55

66
[options]
77
canonical_url =
8-
analytics_id =
8+
analytics_id = G-HLDXVJYYPC
99
analytics_anonymize_ip = False
1010
collapse_navigation = True
1111
sticky_navigation = True

0 commit comments

Comments
 (0)