aquarius : Google analytics with ajax

Load google analytics with ajax, after page was loaded

{if $root->googleanalytics}
    {literal}
        <script>
            $(window).load(function() {
                var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
                $.ajax({
                    url: gaJsHost+'google-analytics.com/ga.js', type: 'get', dataType: 'script', cache: true,
                    success: function() { try { _gat._getTracker("{/literal}{$root->googleanalytics}{literal}")._trackPageview(); } catch(err) {} }
                });
            });
        </script>
    {/literal}
{/if}