All Products
Search
Document Center

Quick Tracking:Basic Integration

Last Updated:Mar 26, 2025

1. Domain settings

Before initialization, developers need to call the setCustomDomain API to set the domain name of the private environment before calling any other SDK API.

API:

/**Set the primary and alternate domain names for reporting statistics logs. This function must be called before the SDK initializes the function call. 
*
@ param primaryDomain The receipt address of the primary domain name to which logs are passed. The parameter cannot be null or an empty string. 
@ param standbyDomain The receipt address of the backup domain name for uploading logs. The parameter can be null or an empty string. If this parameter is empty, the SDK automatically sets the primary domain name as the backup domain name. 
*/

+ (void)setCustomDomain:(NSString *)primaryDomain standbyDomain:(NSString *)standbyDomain;

Parameter:

Parameter

Type

Description

Remarks

primaryDomain

NSString

Primary domain

Required Settings

standbyDomain

NSString

Sub-domain

No

Domain API related to the APM stability database:

+ (void)setLogUploadUrl:(NSString* _Nonnull)uploadUrl;

Value

Description

Remarks

uploadUrl

The receiving address of the domain name for uploading stability logs.

Supported by V2.1.0 and later

Domain API related to the APM performance library:

+ (void) setLogUploadUrl: (NSString *) uploadUrl;

Value

Description

Remarks

uploadUrl

The receiving address of the domain name for uploading performance logs.

Supported by V2.1.0 and later

Example

#import <UMAPM/UMAPMConfig.h>
#import <UMAPM/UMCrashConfigure.h>
#import <UMEFS/UMEFS.h>
#import <UMEFS/UMEFSConfig.h>
#import <UMEFS/UMEFSConfigure.h>
#import <QTCommon/QTCommon.h>
# import <UMCommonLog/UMCommonLogManager.h> // You need to add the

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    UMAPMConfig* config = [UMAPMConfig defaultConfig];   
    config.crashAndBlockMonitorEnable = YES;
    [UMCrashConfigure setAPMConfig:config];

    UMEFSConfig* configForEFS = [UMEFSConfig defaultConfig];
    configForEFS.networkEnable = YES;
    configForEFS.launchMonitorEnable = YES;
    configForEFS.memMonitorEnable = YES;
    configForEFS.javaScriptBridgeEnable = YES;
    configForEFS.oomMonitorEnable = YES;
    configForEFS.pageMonitorEnable = YES;
    configForEFS.logCollectEnable = YES;
    configForEFS.logCollectUserId = @"user1";
    configForEFS.initSendPVEnable = YES;
    [UMEFSConfigure setAPMConfig:configForEFS];

    [QTConfigure setCustomDomain:@"Your collection service domain name" standbyDomain:@""];
    [QTConfigure initWithAppkey:@"Your appkey" channel:@"App Store"];
    
    /**
     * If you need to set the APM domain name separately, please set it through the following interface.
     * [UMCrashConfigure setLogUploadUrl:@"Your collection service domain name"]; // Supported in v2.1.0 and later
     * [UMEFSConfigure setLogUploadUrl:@"Your collection service domain name"]; // Supported by v2.1.0 and later
     * [QTConfigure initWithAppkey:@"Your appkey" channel:@"App Store" shouldPluginsTrackDomainIndepent:YES]; // Supported by V1.5.6.PX and later
     */
  
    return YES;
}

Note: If the data statistics and performance experience use a data collection endpoint, you only need to set [QTConfigure setCustomDomain:@"Your collection service domain name" standbyDomain:@""];".

2. Optional. Set the user ID.

Interface:

+ (void)profileSignInWithPUID:(NSString *)puid;
+ (void)profileSignOff;

Parameters:

Parameter

Type

Description

Comment

puid

NSString

User ID

Example

[QTMobClick profileSignInWithPUID:@"UserID"];

3. Initialize

3.1 Initialization API

To ensure that your app can meet the compliance requirements of the Ministry of Industry and Information Technology (MIIT) after you integrate the statistics SDK, you must make sure that the initial initialization function is called to initialize the statistics SDK after the user reads your Privacy Policy and obtains the user's authorization during the first cold start of the app. In this case, the SDK collects device information and reports data. Conversely, if the user does not agree with the Privacy Policy authorization, the initialization function cannot be called.

/**Initialize all component products
 @ param appKey The appkey that the developer applied for in QT.
 @ param channel The channel identifier. You can set nil to "App Store".
 */
+ (void)initWithAppkey:(NSString *)appKey channel:(NSString *)channel;

Once the App obtains the user authorization of the Privacy Policy, the developer should ensure that the initialization function is called for subsequent App cold start.

3.2. Appkey acquisition

In the product "Management Console"-> "Application Management", find your application to obtain.

4. Enable logging

API:

+ (void)setLogEnable:(BOOL)enable;

If you want to view the logs generated during SDK initialization, you must enable logging before you initialize the SDK. We recommend that you enable logging before you call the API.

The header file:

#import <UMEFS/WPKLog.h>

Examples:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [UMCommonLogManager setUpUMCommonLogManager];
    [QTConfigure setLogEnabled:YES];// Set the data statistics log to be enabled.
    [WPKLog setLogEnable:YES];// Specify to enable the performance experience log.
    [QTConfigure setCustomDomain:@"Your collection service domain name" standbyDomain:nil];// Set the collection domain name.
    [QTConfigure initWithAppkey:@"Your appkey" channel:@"App Store"];
}