Individual page script location



  • I wonder if I can locate the per page scripts of the header at the top of the page in some manner, I mean to locate any individual page script before the hole site scripts such as tag manager.

    <!-- 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','GTM-XXXXXXXX');</script>
    <!-- End Google Tag Manager -->
    <script>
    dataLayer = [{
    'pageCategory': 'signup',
    'visitorType': 'high-value'
    }];

    This is the individual page script header for one of the site page:

    <script>
    dataLayer = [{
    'pageCategory': 'signup',
    'visitorType': 'high-value'
    }];

    As you can see the plugin locates it below the site header and Google suggests to be located before the tag manager script as you can see in https://developers.google.com/tag-manager/devguide

    Thank you in advance


Log in to reply