src/Common/Controller/Base.php
protected function setGlobalJs()
    {
        $oAsset    = Factory::service('Asset');
        $sCustomJs = appSetting('site_custom_js', 'site');
        if (!empty($sCustomJs)) {
            $oAsset->inline($sCustomJs, 'JS');
        }

        // --------------------------------------------------------------------------

        /**
         * If a Google Analytics profile has been specified then include that too
         */
        $sGoogleAnalyticsProfile = appSetting('google_analytics_account');
        if (!empty($sGoogleAnalyticsProfile)) {
            $oAsset->inline(
                "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
                ga('create', '" . appSetting('google_analytics_account') . "', 'auto');
                ga('send', 'pageview');",
                'JS'
            );
        }
    }
protected function setGlobalJs()
    {
        $oAsset    = Factory::service('Asset');
        $sCustomJs = appSetting('site_custom_js', 'site');
        if (!empty($sCustomJs)) {
            $oAsset->inline($sCustomJs, 'JS');
        }

        // --------------------------------------------------------------------------

        /**
         * If a Google Analytics profile has been specified then include that too
         */
        $sGoogleAnalyticsProfile = appSetting('google_analytics_account');
        if (!empty($sGoogleAnalyticsProfile)) {
            $oAsset->inline(
                "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
                ga('create', '" . appSetting('google_analytics_account') . "', 'auto');
                ga('send', 'pageview');",
                'JS'
            );
        }
    }
protected function setGlobalJs ( ) { $ oAsset = Factory :: service ( 'Asset' ) ; $ sCustomJs = appSetting ( 'site_custom_js' , 'site' ) ; if ( ! empty ( $ sCustomJs ) ) { $ oAsset -> inline ( $ sCustomJs , 'JS' ) ; } // -------------------------------------------------------------------------- /**
         * If a Google Analytics profile has been specified then include that too
         */ $ sGoogleAnalyticsProfile = appSetting ( 'google_analytics_account' ) ; if ( ! empty ( $ sGoogleAnalyticsProfile ) ) { $ oAsset -> inline ( "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
                (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
                m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
                })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
                ga('create', '" . appSetting ( 'google_analytics_account' ) . "', 'auto');
                ga('send', 'pageview');" , 'JS' ) ; } }
Sets global JS

@throws \Nails\Common\Exception\FactoryException
Sets global JS