Making WordPress.org

Changeset 7340


Ignore:
Timestamp:
06/28/2018 07:49:32 PM (6 years ago)
Author:
obenland
Message:

Trac: Use Google Tag Manager for analytics.

See #1017.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/site.html

    r7303 r7340  
    3232        pass
    3333?>
     34
     35<!--! Analytics for Core Trac -->
     36<py:if test="project_slug == 'core'">
     37    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
     38        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
     39        j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
     40        'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
     41    })(window,document,'script','dataLayer','GTM-5Z8B3BX');</script>
     42</py:if>
    3443
    3544<!--! These are changes for tickets that are also loaded from
     
    250259
    251260<body py:match="body" id="wordpress-org" class="${project_slug} trac wporg-make make-${project_slug}" py:attrs="select('@*')">
     261
     262    <!--! Analytics for Core Trac -->
     263    <py:if test="project_slug == 'core'">
     264        <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5Z8B3BX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
     265    </py:if>
     266
    252267    <!--! WP.org Global Header -->
    253268    <xi:include href="wporg-header.html" />
     
    283298    <!--! Check for security buzzwords on new tickets -->
    284299    <script py:if="req.environ['PATH_INFO'] == '/newticket'" src="https://s.w.org/style/trac/trac-security.js?${scripts_version}"></script>
    285 
    286     <!--! Analytics for Core Trac -->
    287     <py:if test="project_slug == 'core'">
    288         <script type="text/javascript">
    289         (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    290             (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    291             m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    292         })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
    293 
    294         ga('create', 'UA-52447-27', 'auto');
    295         ga('send', 'pageview');
    296         </script>
    297     </py:if>
    298300
    299301    <!--! Trac auth check -->
Note: See TracChangeset for help on using the changeset viewer.