- Advertising SDK is used to support Apple Search Ads (Apple Search Advertising, referred to as ASA) activation attribution, can track the user's activation and post-link behavior in the full link, and support the front and back link connection, with Shenze advertising analysis products for channel analysis;
- Advertising SDK relies onSensors Analytics SDK 2.6.3 and above. Before use, please ensure that the SDK has been successfully integrated and the SDK has been initialized. For details, seeSDK 集成 (iOS)、SDK integrated(macOS).
Integration step
CocoaPods method
- In Podfile file add pod 'SensorsAdvertising'
- Open the terminal and switch to the project directory
- Excute pod install or pod update SensorsAdvertising
Note
- pod strongly recommends using use_frameworks! Subsequent advertising SDK packages will exist in the form of xcframework.
- If excute pod update The latest version cannot be detected. You can run pod cache clean SensorsAdvertising first to clear local cache.
Source code mode
- From GitHub get SDK source code ;
- Put SDK(SensorsAdvertising → SensorsAdvertising SensorsAdvertising.framework )import App project,and select Copy items if needed。
Procedure of use
The IDFA authorization description is added
In the info. Add NSUserTrackingUsageDescription authorization description file.
Import header file
Import the SensorsAdvertising header file in AppDelegate.m
#import <SensorsAdvertising/SensorsAdvertising.h>
Initialize the SDK
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 初始化 SensorsAnalytics SDK NSString *serverURL = @"http://xxxxx"; SAConfigOptions *saconfigOptions = [[SAConfigOptions alloc] initWithServerURL:serverURL launchOptions:launchOptions]; saConfigOptions.autoTrackEventType = SensorsAnalyticsEventTypeAppStart | SensorsAnalyticsEventTypeAppEnd | SensorsAnalyticsEventTypeAppClick | SensorsAnalyticsEventTypeAppViewScreen; saConfigOptions.enableLog = YES; [SensorsAnalyticsSDK startWithConfigOptions:saConfigOptions]; // 初始化 SensorsAdvertising SDK SADConfigOptions *sadconfigOptions = [[SADConfigOptions alloc] initWithLaunchOptions:launchOptions]; // sadconfigOptions 配置 // ... [SensorsAdvertising startWithConfigOptions:sadconfigOptions]; // 其他业务处理 // ... return YES; }
Note
- The advertising SDK relies on SensorsAnalyticsSDK, so SensorsAnalyticsSDK needs to be initialized first
- The advertising SDK automatically collects activation events, and the original activation event interface should not be manually called
- If the original recorded activation event name is not $AppInstall, you need to use virtual event to merge the original activation event and $AppInstall for analysis. Please consult the on-call colleague for details
- Configure the parameters for the original activation event interface through SADConfigOptions
appInstallProperties: custom properties in the activation event
disableAppInstallCallback: disable the callback request for channel matching in the activation event
autoRequestTrackingAuthorization
By default, the advertising SDK will request IDFA authorization. If you don't want the SDK to automatically request IDFA authorization, you can configure autoRequestTrackingAuthorization = NO
When autoRequestTrackingAuthorization = NO, you must call the advertising SDK interface to pass the authorization status to the SDK
- (void)applicationDidBecomeActive:(UIApplication *)application { if (@available(iOS 14, *)) { [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { [SensorsAdvertising.sharedInstance setTrackingAuthorizationStatus:status]; }]; } }
Note
The setTrackingAuthorizationStatus: interface must be called after the initialization of SensorsAdvertising SDK