All Products
Search
Document Center

Application Real-Time Monitoring Service:Buffer data before SDK initialization

Last Updated:Mar 10, 2026

When the Application Real-Time Monitoring Service (ARMS) Browser Monitoring SDK loads asynchronously, data reporting may fail if method calls are made before initialization completes. Use the __bl.pipe mechanism to queue these calls so the SDK executes them automatically after it initializes.

Why data gets dropped

The SDK is loaded asynchronously, so a gap exists between when your page starts generating monitoring data and when the SDK is ready to process it. Two scenarios commonly trigger this:

  • Page-load reporting: The page generates API calls, page views (PV), or custom messages while the SDK script is still downloading or initializing, or the initialization result cannot be determined.

  • Early configuration: Application startup logic calls setConfig before the asynchronously loaded SDK is available.

Any SDK method call made during this gap may fail unless you buffer it with __bl.pipe.

Queue multiple calls

The SDK adds the pipe attribute to the __bl object to cache pre-called information. Assign a nested array to __bl.pipe where each inner array represents one SDK method call: the first element is the method name (string), and the remaining elements are the parameters.

__bl.pipe = [
    // Report the current HTML page as an API request.
    // Equivalent to: __bl.api(api, success, time, code, msg)
    ['api', '/index.html', true, performance.now, 'SUCCESS'],

    // Enable automatic single-page application (SPA) resolution after initialization.
    ['setConfig', {enableSPA: true}]
];

After initialization completes, the SDK replays each cached call in order from window.__bl.pipe.

Queue a single call

For a single SDK call, use a flat array instead of a nested array:

__bl.pipe = ['msg', "I'm another generic message"];

Queue in a single-page application

In a single-page application (SPA) with autoSend: false, PV data is reported for the first time after the application initialization. However, whether the initialization is complete cannot be determined. Use __bl.pipe to handle this:

// Set the page name to "homepage" and report PV data.
__bl.pipe = ['setPage', 'homepage'];

Call pipe when initialization state is uncertain

If you are unsure whether the SDK has initialized and do not want to add complex conditional checks, you can call the pipe method after the SDK is initialized. This is supported in Internet Explorer 9 and later.

Important

Before initialization completes, each assignment to __bl.pipe overwrites the previous value. Only the last assigned value is executed. To buffer multiple calls in a single assignment, use a nested array as shown in the Queue multiple calls section above.