locked
Javascript track event not firing for several seconds after method call. RRS feed

  • Question

  • I am noticing a problem with the appInsights track event js code.

    My events dont seem to get sent to AI until around 6 seconds after the initial method call. Has anyone else noticed this as a problem?

    When I debug my scripts I can definately see the event being fired way before the request happens.

    I'm replicating this in Chrome and FF.

    Many thanks

    Thursday, March 5, 2015 2:52 PM

Answers

  • As a temporary work around you can invoke: appInsights.context._sender.triggerSend();

    Our next release will support appInsights.flush() which will cause all data to be sent immediately.


    Anastasia

    Friday, March 13, 2015 9:24 PM

All replies

  • JS SDK has buffer logic. Buffer is flushed every 15 seconds or if it reaches a certain payload size.

    Anastasia

    Friday, March 6, 2015 4:55 AM
  • Thanks for the advice.

    I was looking to raise an event when my javascript authentication provider raises an error. A buffer time of 15 seconds is longer than many users are likely to hang around for after throwing an error before reloading the web page or closing the browser window.

    What would be best practice in this scenario?

    May thanks

    Friday, March 13, 2015 5:34 PM
  • As a temporary work around you can invoke: appInsights.context._sender.triggerSend();

    Our next release will support appInsights.flush() which will cause all data to be sent immediately.


    Anastasia

    Friday, March 13, 2015 9:24 PM