Basic integration

更新时间:
复制 MD 格式

macOS SDK compliance

Compliance statement

  • Your application must not collect personal information before the user agrees to the privacy policy. Display the privacy policy and obtain user consent on the app's first launch.

  • You must inform users that your app integrates the QuickTracking SDK and add the following clause to your privacy policy:

    • Our product integrates the QuickTracking SDK. The QuickTracking SDK collects your OS, OS version, timezone, language, screen resolution, device manufacturer, device model, device brand, and network information to provide statistical analysis.

  • Initialize the QuickTracking SDK only after the user agrees to your privacy policy.

SDK initialization

Initialization enables analytics. To prevent data loss, initialize the SDK on the main thread at your application's entry point.

Appkey

The appkey is a unique identifier for your application in QuickTracking, generated when you create the application. To find your appkey, see application management.

Tracking domain

The tracking domain is the address where the SDK sends logs. Find it in the QuickTracking management console under management console > Data collection > tracking domain.

SDK initialization

#import <QuickTrackingSDK/QuickTrackingSDK.h>

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    QTSDKConfig *sdkConfig;
    // Initialize the SDK configuration.
    sdkConfig = [[QTSDKConfig alloc] initWithAppkey:@"your-appkey"
                                        trackDomain:@"https://your-tracking-domain"
                                      launchOptions:nil];
                                      
    // Set the application's distribution channel, e.g., "AppStore".
    sdkConfig.channel = @"your-distribution-channel";
    
    // Set the minimum interval for batch sending in milliseconds. Default is 3000.
    sdkConfig.batchSendInterval = 3000;
    
    // Enable SDK logging. Disabled by default.
    sdkConfig.enableLog = YES; 
    
    // Ensure the SDK is not disabled. Default is NO.
    // sdkConfig.disableSDK = NO;
    
    // Wait for logs to send before the app enters the background. Default is NO.
    // sdkConfig.enableSendLogsBeforeEnterBackground = YES;
    
    // Identifier for tracking validation, found under "management console > Data collection > tracking validation > PC application validation".
    // sdkConfig.debugKey = @"97052112091876_xxxxx";
    
    // Set the maximum number of events to store in the local cache. The default is 10,000. Older events are deleted if the limit is exceeded.
    // sdkConfig.maxCacheSize = 10000;
      
    // Enable the JS bridge to listen for events from a web view. Disabled by default.
    // sdkConfig.enableJSBridge = YES;
    
    // Initialize the SDK.
    [QuickTrackingSDK initWithConfig:sdkConfig];
}

QTSDKConfig parameters

Parameter

Type

Description

Required

appkey

nonnull NSString

The unique identifier for your application.

Yes

trackDomain

nonnull NSString

The destination for sending data.

Yes

launchOptions

nullable id

Configuration properties for application startup. Can be nil.

No

QTSDKConfig properties

Property

Type

Description

Required

batchSendInterval

NSInteger

The minimum interval between batch sends, in milliseconds. The default and minimum value is 3,000 ms (3 seconds).

No

maxCacheSize

NSInteger

The maximum number of events to store in the local cache. The default is 10,000. If the limit is exceeded, older events are deleted.

No

batchSendQueueSize

NSInteger

The maximum number of cached logs that triggers an upload. The default is 100. Note: Setting this value too high can cause network requests to fail.

No

enableLog

BOOL

Enables or disables SDK logging. Default: NO.

No

disableSDK

BOOL

Disables the SDK, preventing it from triggering events or sending network requests. Default: NO.

No

enableSendLogsBeforeEnterBackground

BOOL

Waits for data to finish sending before the app enters the background. Default: NO.

No

cacheFilePath

NSString

Custom storage path for tracked event data. Applies only in macOS development environments.

No

channel

NSString

The distribution channel for the application.

No

debugKey

NSString

The identifier for the tracking validation feature.

No

enableJSBridge

Boolean

Enables the JS bridge to listen for events from a web view. Default: NO.

No