All Products
Search
Document Center

Quick Tracking:Import and initialize the Web SDK

Last Updated:Jun 02, 2026

Import and initialize the QuickTracking Web SDK to enable data collection in your web or H5 application. All steps are required—skipping any step causes data loss.

SDK information

SDK name

Version

MD5

QuickTracking Web SDK

Latest version: 2.4.25

Release notes: Web SDK release notes

qt_web.umd.js: cb036261b8f0996ef4dd3abfe26796bb

qt_web.cjs.js: f67788cee3bca2a357e9d7152a7d7e24

qt_web.iife.js: 9562dd302dce901242ceb0c3efc3fc63

qt_web.amd.js: e5dd1994abc6c2da3096ef1bfc62e5db

Integration methods

1. Quick integration

The Quick Tracking console generates a unique integration code snippet for each web application. Follow the in-product guide to complete integration.

Console path

Go to Quick Tracking > Home > Management Console > Organization List. Find your application's organization, click Manage Applications, then click Integrate in your application's entry.image

On the integration page, copy the unique integration code. Click Next and follow the Integration Verification guide to confirm success.image

2. Manual integration

If you cannot access the quick integration page, use the following code snippets to integrate the SDK manually.

2.1. Prepare parameters

appKey: Find this in the application list.

Data collection domain: Management Console > Collection Information.

SDK URL: Management Console > Collection Information.

2.2. Import and initialize the SDK

Initialization enables data collection. Once you have the SDK URL, add the integration code inside the tag of your page. Ensure that the aplus_queue object is not overwritten.

(function(w, d, s, q) { 
 w[q] =w[q] || []; 
 var f=d.getElementsByTagName(s)[0],
 j=d.createElement(s); 
 j.async=true; 
 j.id='beacon-aplus'; 
 j.src='YOUR_SDK_URL'; 
 f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'aplus_queue');

Set the domain and appKey. Add the following code immediately after the SDK import code.

// The appKey of your application.
aplus_queue.push({ 
    action: 'aplus.setMetaInfo', 
    arguments: ['appKey', 'YOUR_APPKEY'] 
});

// For a private cloud deployment, you must also configure the log server domain immediately after the preceding JavaScript code.
// The log server domain for a private cloud is typically in the format `xxx-web-api.xxx.com.cn`. Get the specific domain from the Collection Information module in the Management Console.
aplus_queue.push({ 
    action: 'aplus.setMetaInfo', 
    arguments: ['trackDomain', 'YOUR_DATA_COLLECTION_DOMAIN']  
});

2.3. Listen for initialization status

To send event tracking data only after the SDK is fully initialized, add a listener for aplusReady.

Example code:

aplus_queue.push({
    action: "aplus.aplus_pubsub.subscribe",
    arguments: ["aplusReady", function(status) {
        if (status === 'complete') {
        }
    }]
})

2.4. Event reporting callbacks

To receive event reporting callbacks, enable POST mode and configure the aplus_error_listener property.

Error callback properties

Value and description

Default

aplus-post-mode

  • true: Enables POST mode. With aplus_error_listener configured, you receive error information.

  • false: Disables POST mode. Error callbacks are not available.

false

aplus_error_listener

  • Error callback function

null

Callback description:

With aplus-post-mode enabled, error callbacks are delivered through the aplus_error_listener property or the onError method.

Callback parameters

Type

Description

err

string

Network error reason

data

string

Reported payload

url

string

Reporting URL

Example code:

// Enable POST mode.
aplus_queue.push({
  action: 'aplus.setMetaInfo',
  arguments: ['aplus-post-mode', true],
});
// Enable the error listener.
aplus_queue.push({
  action: 'aplus.setMetaInfo',
  arguments: ['aplus_error_listener', (err,data,url)=>{
    // err: Network error code.
    // data: The payload being reported.
    // url: The reporting URL.
  }]
});

Resending data

Method

Parameter

retrySendData

url: Reporting URL

data: Data to be reported

Example code:

// Trigger a retry for sending data.
aplus_queue.push({
  action: 'aplus.retrySendData',
  arguments: [url, data] // Reporting URL, data to be reported
});
  
// Alternative method
aplus.retrySendData(url, data) // Reporting URL, data to be reported
  • Recommendation: Use for error tracing only. Do not use in core business logic or high-frequency loops.

  • Resource Consumption: XHR requests consume network resources even when asynchronous.

  • Performance issues: Unlike sendBeacon, XHR does not support send-on-unload. Requests may be aborted when the page closes, so 100% delivery is not guaranteed.

  • Network dependency: In poor network conditions, retries are also likely to fail.

  • Browser compatibility: XHR behavior varies across browsers; this feature may not work as expected in all environments.

3. FAQ

3.1. How do I get the offline SDK?

Get the SDK URL from Management Console > Collection Information. Open the URL in a browser and press Ctrl+S (or Cmd+S on macOS) to save the file locally.