Delay real-time measurement reporting

For cases when you want to delay the mPulse beacon from firing on the load event.

The following code delays the firing of the mPulse beacon for 2.5 seconds. This delays the real-time measurement reporting by 2.5 seconds. Prepend this code in the original JavaScript code snippet (see Add the mPulse snippet to your pages manually).
Note: This may result in the loss of beacon data for any page requests where the visitor moves away from the page or closes the browser during the delay period. Making the delay as short as possible is the best practice.
<script>
(function(){
  // Ensure we have the BOOMR namespace to work with
  BOOMR = window.BOOMR ||{};
  BOOMR.plugins = BOOMR.plugins ||{};

  // holds the beacon until this is true
  var complete =false;

  // create a custom plugin to hold the beacon until we're ready
  BOOMR.plugins.MyCustomPlugin ={
    is_complete:function(){
      return complete;
    }
  };

  functiondelayBeacon(){
    setTimeout(function(){
      complete =true;

      //trigger the beacon
      if(typeof BOOMR.sendBeacon ==="function"){
        BOOMR.sendBeacon();
      }
    },2500);
  }

  if(window.addEventListener){
    window.addEventListener("load", delayBeacon,false);
  }elseif(window.attachEvent){
    window.attachEvent("onload", delayBeacon);
  }

  //#########################################################
  // standard Boomerang loader script function code goes here
  //#########################################################

})();
</script>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍