javascriptjqueryboomerang

How to add ajax execution time in boomrang page load time?


I am using boomerang plugin to check web performance.

Following the code that used to get page load time.

<script type="text/javascript" src="http://yui.yahooapis.com/combo?3.1.1/build/yui/yui-base-min.js&3.1.1/build/oop/oop-min.js&3.1.1/build/yui/yui-later-min.js&3.1.1/build/event-custom/event-custom-base-min.js&3.1.1/build/querystring/querystring-stringify-simple-min.js&3.1.1/build/io/io-base-min.js"></script>

<script src="/js/boomerang.js" type="text/javascript"></script>
<script src="/js/plugins/rt.js" type="text/javascript"></script>
<script src="/js/plugins/bw.js" type="text/javascript"></script>
<script src="/js/plugins/navtiming.js" type="text/javascript"></script>
<script type="text/javascript">
BOOMR.init({
        BW: {
         enabled: false,
            cookie: 'HOWTO-BA'
        },
        RT: {
            cookie: 'HOWTO-RT'
        }
    });
    YUI().use("io-base", function(Y) {
    var uri = "dynamic-content.txt?" + new Date().getTime();
    var timer;

    function complete(id, o) {
        var html = "<p>\n" + o.responseText.replace(/^$/mg, '</p>\n<p>') + "\n</p>";
    document.getElementById("dynamic-content").innerHTML = html;
    if(timer) timer.loaded();
    };

    Y.on('io:complete', complete);

    timer = BOOMR.requestStart("my-timer");
    var request = Y.io(uri);
});

BOOMR.plugins.RT.setTimer("t_js", new Date().getTime() - t_pagestart).
        startTimer("t_head");

</script>

script src="/pgr/js/howtos.js" type="text/javascript"></script>
<script type="text/javascript">
BOOMR.plugins.RT.endTimer("t_howtojs").endTimer("t_body");
</script>

Here YUI that make separate ajax call and adds execrutiont ime in page load time. In my website there are many ajax calls on page load, those execution time I want to add in page load time.

But stuck how to use YIU with existing code.

My ajax call

jQuery(document).ready(function($) {   
$.ajax({
            type    : 'POST',
            url     : '/getdata/',
            data    : { sid:retSid},
            dataType: 'JSON',
            beforeSend: function(){
                $('.blocker').show();
            },
            success : function(result) {
                if(result.data)
                {

        ....

        }

    });
});

Solution

  • You should use one of the SPA plugins to measure single page apps / AJAX apps. It would be better to ask your question on the boomerang support forum. We prefer keeping all discussion and issues in one place so that if a code change is required, we can reference the discussion via a git reference.

    You can ask the question here: https://github.com/soasta/boomerang/issues