Skip to content

Commit 14a49da

Browse files
author
Svetlana Karslioglu
authored
Add New GTAG
Re: pytorch/pytorch.github.io#1397 Adding the new GTAG to populate on all sites that use pytorch_sphinx_theme.
1 parent a1dbd5c commit 14a49da

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

pytorch_sphinx_theme/layout.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,13 @@
7676
{%- endblock %}
7777

7878
{%- block extrahead %}
79-
<!-- Google Analytics -->
80-
{% if theme_analytics_id %}
81-
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script>
82-
<script>
83-
window.dataLayer = window.dataLayer || [];
84-
function gtag(){dataLayer.push(arguments);}
85-
gtag('js', new Date());
86-
87-
gtag('config', '{{ theme_analytics_id }}');
88-
</script>
89-
{% endif %}
90-
<!-- End Google Analytics -->
79+
<!-- Google Tag Manager -->
80+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
81+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
82+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
83+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
84+
})(window,document,'script','dataLayer','GTM-T8XT4PS');</script>
85+
<!-- End Google Tag Manager -->
9186
{% endblock %}
9287

9388
{# Keep modernizr in head - http://modernizr.com/docs/#installing #}
@@ -321,6 +316,10 @@
321316
{% endif %}
322317

323318
{%- block content %}
319+
<!-- Google Tag Manager (noscript) -->
320+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-T8XT4PS"
321+
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
322+
<!-- End Google Tag Manager (noscript) -->
324323
{% if theme_style_external_links|tobool %}
325324
<div class="rst-content style-external-links">
326325
{% else %}

0 commit comments

Comments
 (0)