Quick App SDK supports common tracking events and properties, such as startup events, exit events, page events, custom events, user properties, and global properties.
1. Import and configure SDK
To integrate the Quick Tracking service into your quick application project, you need to obtain the latest quick application SDK. Visit the following online address to download or directly reference the latest version of the SDK file:
Quick application SDK online address: https://g.alicdn.com/dt-f2e/qt-quickapp-sdk/1.0.0/qt_quickapp.js
Log on to the quicktracking platform and go to the management console -- collect information -- mini program sdk information

Place the qt_quickapp.js file in the directory corresponding to the project (example: src/assets/js is used as an example)
In the app entry file app.ux file, add the
// Add the header to the app.ux file. import qt from './assets/js/qt_quickapp.js';configure sdk parameters
call setParams to initialize the sdk after the sdk is introduced
// Add the header to the app.ux file. import qt from './assets/js/qt_quickapp.js'; qt.setParams({ /************ Required Fields ************* / appKey: 'AppKey' of the current application', trackDomain: 'The domain name of the current application', /************ Optional Fields ************* / showLog: true, // Specifies whether to display the SDK log. true. false. userId: 'test_user', // The user account. You can also call the login operation to configure the globalproperty: { // The global property of the event. a:1, b:2 } });
2. Initialize the SDK
after configuring the parameters of the sdk, call the init method to initialize the sdk.
// onCreate method of the app.ux file
export default {
onCreate(options) {
// Initialize the SDK.
qt.init(); // Register qt globally
}
}3. Add tracking
3.1 Application startup tracking
API:qt.appLaunch ('Parameters for starting the application')
// Call the qt.appLaunch() method in the onCreate method in the app.ux file.
export default {
onCreate(options) {
qt.init();
qt.appLaunch(options);
},
...
}3.2 Application exit tracking
API:qt.appHide()
// Call the qt.appHide() method in the onHide method in the app.ux file.
export default {
onHide() {
qt.appHide();
}
}3.3 Page browsing event tracking
API:qt.sendPageStart ('Event property object')
Event property object: This field represents the custom parameter of the event. Its value is a JSON object (a simple tiled object, which cannot be nested in multiple layers). The parameter value can be string, number, or boolean in JavaScript. If the parameter value is empty, pass the value "".
Examples:
// test page pages/TestPage/index.ux
export default {
...
onShow() {
qt.sendPageStart({
page_name: 'test_page', // Optional. The page encoding.
page_title: 'Page title', // (Optional) The name of the page.
param1: 'xxx',
param2: 'xxx'
});
}
...
}3.4 Event tracking
API:qt.sendEvent ('Event code', 'Event property object')
Event Code: This field is the event code of custom events such as click, exposure, and other events registered in the Quicktracking management platform. Only the English string format is supported, and the maximum length is 128-digit.
Event property object: This field represents the custom parameter of the event. Its value is a JSON object (a simple tiled object, which cannot be nested in multiple layers). The parameter value can be string, number, or boolean in JavaScript. If the parameter value is empty, pass the value "".
Examples:
// test page pages/TestPage/index.ux
export default {
...
onTestButtonClick() {
qt.sendEvent('test_clk', {
page_name: 'test_page', // Optional. The page encoding.
page_title: 'Page title', // (Optional) The name of the page.
param1: 'xxx',
param2: 'xxx'
});
}
...
}4. Configure global attributes
API:qt.setGlobalProperty ('global attribute object')
// Method 1.
qt.setGlobalProperty({
param1: '1111',
param2: 2222,
param3: true
});
// Method 2
qt.setParams({
....
globalproperty: {
param1: '1111',
param2: 2222,
param3: true
}
});
The globalproperty after the preceding call is:{ param1: '1111', param2: 2222, param3: true }
Append Global Attributes
API:qt.appendGlobalProperty ('global attribute object')
qt.appendGlobalProperty({
param4: '4444',
param5: 55555
});The globalproperty after the preceding call is:
{ param1: '1111', param2: 2222, param3: true, param4: '4444', param5: 55555 }
5. Set a user account
API:qt.login ('user account id')
qt.login ('account id') // Report the account and cache the account.API:qt.logoff()
qt.logoff() // Clear the user account cache6. Report user attributes
API:qt.sendUserProfile ('user attribute object')
Note: Before reporting user attributes, you need to report user accounts
qt.sendUserProfile({
name: 'Jack',
age: '25',
level: 'vip3'
});7. Collect multiple types of IDs.
API:qt.setIds ('Object composed of multiple IDs')
Note: Make sure that the key of each ID is correctly written.
qt.setIds({
openId: 'xxxx',
unionid: 'xxxxx',
androidId: 'xxxxx',
advertisingId: 'xxxxx',
phonenumber: 'xxxxx',
mac: 'xxxxx',
oaid: 'xxxxx',
serial: 'xxxxx',
deviceId: 'xxxxx'
});For more information about the meanings of the preceding id fields, see the official documentation of Quick Application.
https://doc.quickapp.cn/features/service/account.html?h=openid
https://doc.quickapp.cn/features/system/device.html?h=deviceId
8. View SDK logs
Set the showLog parameter to true for the SDK.
qt.setParams({
...
showLog: true
})
9. Tracking Verification
After completing the tracking function, the developer can verify the existing tracking through the tracking verification function of the QuickTracking platform, first obtain the debugId in the form of log_xxxx, and add it to the sdk configuration parameter to enable log reporting in tracking verification mode.
Insert the debugId to configure the tracking
// Add the header to the app.ux file.
import qt from './assets/js/qt_quickapp.js';
qt.setParams({
...
debugId: 'log_xxxxxxxx', // Used for tracking verification
....
});