|
33 | 33 | <% } %> |
34 | 34 | <title>{{ datasets.base.title }}</title> |
35 | 35 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 36 | + |
| 37 | + {% if let Some(analytics) = analytics %} |
| 38 | + {% if let Some(gtm) = analytics.gtm %} |
| 39 | + {% if let Some(tag) = gtm.container_id %} |
| 40 | + <!-- Google tag (gtag.js) --> |
| 41 | + <script async src="https://www.googletagmanager.com/gtag/js?id={{tag}}"></script> |
| 42 | + <script> |
| 43 | + window.dataLayer = window.dataLayer || []; |
| 44 | + function gtag(){dataLayer.push(arguments);} |
| 45 | + gtag('js', new Date()); |
| 46 | + |
| 47 | + gtag('config', '{{tag}}'); |
| 48 | + </script> |
| 49 | + {% endif %} |
| 50 | + {% endif %} |
| 51 | + {% endif %} |
| 52 | + |
36 | 53 | <% if (isDev) { %> |
37 | 54 | <script> |
38 | 55 | fetch("./static/data/base.json") |
|
49 | 66 | window.statsDS = {{ datasets.stats|json_compact|safe }}; |
50 | 67 | </script> |
51 | 68 | <% } %> |
52 | | - <% if (!isDev) { %> |
53 | | - {% set gtm_container_id = analytics|get_gtm_container_id %} |
54 | | - {% if let Some(gtm_container_id) = gtm_container_id %} |
55 | | - <!-- Google Tag Manager --> |
56 | | - <script defer data-container-id="{{ gtm_container_id }}" src="assets/gtm.js"></script> |
57 | | - <!-- End Google Tag Manager --> |
58 | | - {% endif %} |
59 | | - <% } %> |
60 | 69 | </head> |
61 | 70 | <body> |
62 | | - <% if (!isDev) { %> |
63 | | - {% if let Some(gtm_container_id) = gtm_container_id %} |
64 | | - <!-- Google Tag Manager (noscript) --> |
65 | | - <noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ gtm_container_id }}" |
66 | | - height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
67 | | - <!-- End Google Tag Manager (noscript) --> |
68 | | - {% endif %} |
69 | | - <% } %> |
70 | 71 | <div id="landscape"></div> |
71 | 72 | <script type="module" src="/src/index.tsx"></script> |
72 | 73 | </body> |
|
0 commit comments