Skip to content

Commit

Permalink
Merge pull request #182 from pytorch/add-gtag
Browse files Browse the repository at this point in the history
Add New GTAG
  • Loading branch information
Svetlana Karslioglu authored Jun 16, 2023
2 parents a1dbd5c + 504e8be commit cb6d58c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pytorch_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,13 @@
{%- endblock %}

{%- block extrahead %}
<!-- Google Analytics -->
{% if theme_analytics_id %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ theme_analytics_id }}');
</script>
{% endif %}
<!-- End Google Analytics -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ theme_analytics_id }}');</script>
<!-- End Google Tag Manager -->
{% endblock %}

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

{%- block content %}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ theme_analytics_id }}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{% if theme_style_external_links|tobool %}
<div class="rst-content style-external-links">
{% else %}
Expand Down

0 comments on commit cb6d58c

Please sign in to comment.