Making WordPress.org


Ignore:
Timestamp:
10/17/2019 05:16:38 AM (6 years ago)
Author:
dd32
Message:

WordPress.org: Load Google Tag Manager through an mu-plugin rather than loading it manually in many themes.

See #4625.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/functions.php

    r9183 r9195  
    10291029
    10301030add_filter( 'handbook_display_toc', '__return_false' );
    1031 
    1032 /**
    1033  * Output the GoogleTagManager <head> tags.
    1034  */
    1035 function wporg_gutenberg_gtm() {
    1036     ?>
    1037 
    1038     <link rel="dns-prefetch" href="//www.googletagmanager.com">
    1039 
    1040     <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
    1041     new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
    1042     j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
    1043     'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
    1044     })(window,document,'script','dataLayer','GTM-P24PF4B');</script>
    1045 
    1046     <?php
    1047 }
    1048 add_action( 'wp_head', 'wporg_gutenberg_gtm' );
Note: See TracChangeset for help on using the changeset viewer.