@@ -60,15 +60,32 @@ fn diagram_only_init() -> bool {
60
60
}
61
61
}
62
62
63
+ #[ component]
64
+ pub fn GoogleAnalyticsHeader ( ) -> impl IntoView {
65
+ view ! {
66
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-QWXYFJ1NED" ></script>
67
+ <script>
68
+ "\
69
+ window.dataLayer = window.dataLayer || [];\n \
70
+ function gtag(){dataLayer.push(arguments);}\n \
71
+ gtag('js', new Date());\n \
72
+ gtag('config', 'G-QWXYFJ1NED');\n \
73
+ "
74
+ </script>
75
+ }
76
+ }
77
+
63
78
#[ component]
64
79
pub fn GoogleTagManagerHeader ( ) -> impl IntoView {
65
80
view ! {
66
81
<script>
67
- "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\
68
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\
69
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\
70
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\
71
- })(window,document,'script','dataLayer','GTM-W2485ZNP');"
82
+ "\
83
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':\n \
84
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],\n \
85
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=\n \
86
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);\n \
87
+ })(window,document,'script','dataLayer','GTM-W2485ZNP');\n \
88
+ "
72
89
</script>
73
90
}
74
91
}
@@ -104,6 +121,7 @@ pub fn App() -> impl IntoView {
104
121
// through client side routing.
105
122
if site_prefix. is_empty ( ) {
106
123
view ! {
124
+ <GoogleAnalyticsHeader />
107
125
<GoogleTagManagerHeader />
108
126
109
127
// injects a stylesheet into the document <head>
0 commit comments