1 Overview of SDK principles
1.1 Principle
The SDK provides a command-based tracking method. You can send a command to the command queue aplus_queue of the aplus environment variable. The aplus environment variable executes the command to meet your requirements. The command format is as follows:
aplus_queue.push({
'action': "$APIName",
'arguments': [$arguments] // The arguments are the input parameters of the specified API,
})The action parameter represents the name of the API that sends the instruction. Its input parameter is a string and the value is an enumerated value. Available enumerated values are as follows
setMetaInfo: overwrites the existing default settings of the SDK
appendMetaInfo: the default configuration of the append SDK
getMetaInfo: obtains the current configuration of the SDK.
record: used to send event logs
sendPV: used to send page logs
The arguments parameter is the input parameter of the API specified in the action. The format is an array. The order of the elements in the array is the same as the order of the input parameter defined by the API.
1.2 Example
// Change the default settings of the SDK.
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: [metaName, metaValue]
});
// Obtain the current configuration of the SDK.
aplus.getMetaInfo(metaName);
// Used to send event logs.
aplus_queue.push({
action: 'aplus.record',
arguments: [trackerEventCode, eventType, eventParams]
});
// Used to send page logs.
aplus_queue.push({
action: 'aplus.sendPV',
arguments: [pageEventConfig, userData]
});2 Log Printing
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['DEBUG', true]
});3 Log Sending Strategy
When the event is triggered, it will be reported in real time.
4. Configure basic application information
In the SDK introduction section, you can modify or append some default settings
// The appKey of the integrated application.
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['appKey', 'xxxxxxx']
})
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['aplus-rhost-v', 'quickaplus-Web-api.xxx.com.cn']
});
// Enable the debugging mode.
aplus_queue.push({
action: 'aplus.setMetaInfo',
arguments: ['DEBUG', true]
});MetaName | Meta configuration description | MetaValue assignment description | Supported MongoDB versions |
DEBUG | When enabled, the console will output SDK tracking logs | true to open the log, false to close the log | all |
appVersion | Set the version of the current Web | Please enter the version of the current web | all |
appKey | The Appkey that you entered when you created an application in the platform system | You need to obtain the appkey corresponding to the embedded Web application in the platform. | all |
aplus-rhost-v | Track and Report Domain (Deprecated) | You can obtain the information tracked by the platform. | all |
trackDomain | Track and report domain | You can obtain the information tracked by the platform. | Starting with v2.0.0 |
_dev_id | Custom device ID | This mode overwrites the device ID automatically generated by the QuickTracking SDK. | all |
_user_id | Set userid | The ID of the custom logon account. | all |
_hold | Send a hold signal. You can set_hold multiple times throughout the SDK lifecycle. BLOCK and START must be used in pairs. Otherwise, log sending is affected. | The enumeration type. The available values and descriptions are as follows:
| all Note: This parameter only applies to aplus_queue.push API calls. |
aplus-jsbridge-only | H5 reporting log switch |
| all |
aplus-utm-expire-days | set the expiration time of utm parameters | By default, the current session period is valid. You can customize the expiration time of the utm parameter by day. The result is stored in a cookie. The maximum expiration time setting is subject to the actual maximum expiration time of cookies supported by each browser. | v2.0.7 Start |
aplus-preset-events-disabled | Prefabricated event used to disable SDK default tracking | The default value is undefined. You can assign values to arrays. Example: | v2.0.9 Start |