|
64 | 64 | <!--[if lt IE 9]> |
65 | 65 | <script src="{{ pathto('_static/js/html5shiv.min.js', 1) }}"></script> |
66 | 66 | <![endif]--> |
| 67 | + |
| 68 | + {%- if theme_analytics_id %} |
| 69 | + <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': |
| 70 | + new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], |
| 71 | + j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= |
| 72 | + 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); |
| 73 | + })(window,document,'script','dataLayer','{{ theme_analytics_id }}');</script> |
| 74 | + {%- endif %} |
| 75 | + |
67 | 76 | {%- if not embedded %} |
68 | 77 | {# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #} |
69 | 78 | {%- if sphinx_version_info >= (1, 8) -%} |
@@ -248,22 +257,9 @@ <h4>Need support?</h4> |
248 | 257 | }); |
249 | 258 | </script> |
250 | 259 |
|
251 | | - {#- Do not conflict with RTD insertion of analytics script #} |
252 | | - {%- if not READTHEDOCS %} |
253 | | - {%- if theme_analytics_id %} |
254 | | - <!-- Theme Analytics --> |
255 | | - <script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script> |
256 | | - <script> |
257 | | - window.dataLayer = window.dataLayer || []; |
258 | | - function gtag(){dataLayer.push(arguments);} |
259 | | - gtag('js', new Date()); |
260 | | - |
261 | | - gtag('config', '{{ theme_analytics_id }}', { |
262 | | - 'anonymize_ip': {{ 'true' if theme_analytics_anonymize_ip|tobool else 'false' }}, |
263 | | - }); |
264 | | - </script> |
265 | | - |
266 | | - {%- endif %} |
| 260 | + {%- if theme_analytics_id %} |
| 261 | + <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PDL826" |
| 262 | + height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> |
267 | 263 | {%- endif %} |
268 | 264 |
|
269 | 265 | {%- block footer %} {% endblock %} |
|
0 commit comments