iOS ANSDK settings
Xandr Mobile SDK provides various settings you can use to help you in the development of your app. In this article, find details about the methods or properties, input parameters, returned values, restrictions, guidelines, and examples for the iOS ANSDK settings.
Property | Description |
---|---|
(void) optionalSDKInitialization:(sdkInitCompletion _Nullable)success |
Pre-configures common settings such as checking the presence of the User Agent during initialization, preparing a WebView, etc. See Initialize SDK Settings below for more details. |
NSString *publisherUserId |
Specifies the Publisher User ID for current application user. See User ID(s) Mapping below for more details. |
NSArray<ANUserId *> *userIdArray |
Specifies a dictionary containing objects that hold User ID parameters. See User ID(s) Mapping below for more details. |
BOOL disableIDFVUsage |
Includes or excludes the IDFV field in ad request. See User ID(s) Mapping below for more details. |
NSString *geoOverrideCountryCode |
Assigns a country code. See Support for Overriding Country Codes and Zip Codes below for more details. |
NSString *geoOverrideZipCode |
Assigns a zip code. See Support for Overriding Country Codes and Zip Codes below for more details. |
(void)setLocationWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude timestamp:(nullable NSDate *)timestamp horizontalAccuracy:(CGFloat)horizontalAccuracy precision:(NSInteger)precision |
Controls how accurate the location data is that you pass to the ad server. See Location Controls below for more details. |
BOOL locationEnabledForCreative |
Controls the location access for creatives. See Location Controls below for more details. |
BOOL doNotTrack |
Indicates if you have information in the app about user opt-out. See Publisher Side User Opt-Out below for more details. |
BOOL disableIDFAUsage |
Excludes the IDFA field in ad request. See Set IDFA usage below for more details. |
NSUInteger auctionTimeout |
Sets the timeout period in milliseconds. See Set the Auction Timeout below for more details. |
BOOL enableTestMode |
Sets YES or NO for the AdRequests to be executed in the test mode. See Set Test Mode below for more details. |
BOOL enableOMIDOptimization |
Enables Open-Measurement Optimization. See OMID Optimization below for more details. |
NSString *contentlanguage |
Sets the code for the content's language. See Set Content Language below for more details. |
Initialize SDK settings
Method | Description |
---|---|
(void) optionalSDKInitialization:(sdkInitCompletion _Nullable)success |
Method that allows you to pre-configure common settings such as checking the presence of the User Agent during SDK initialization, preparing a WebView etc. The completion block of this Property returns “true” if SDK initialization completes successfully and “false” if it fails. |
Example
[[ANSDKSettings sharedInstance] optionalSDKInitialization:^(BOOL isSDKInitialized) {
if(isSDKInitialized){
NSLog(@"SDK Initialized");
}else{
NSLog(@"SDK did not initialize");
}
}];
User ID(s) mapping
Important
- This offering is currently in Alpha and is subject to changes or deprecation without notice.
- The externalUid property of
ANBannerAdView
,InterstitialAdView
,ANNativeAdRequest
andANInstreamVideoAd
class is now deprecated. You can usepublisherUserId
property described below inANSDKSettings
class instead. The deprecated properties will be removed in SDK v8.0. - The property
ANSDKSettings.externalUserIdArray
andANExternalUserId
class are now deprecated and will be removed in SDK v8.0. You can use the equivalent propertyANSDKSettings.userIdArray
andANUserId
class described below instead as a replacement.
Property | Description |
---|---|
NSString *publisherUserId |
Specifies a string that corresponds to the Publisher User ID for current application user. |
NSArray<ANUserId *> *userIdArray |
Specifies a dictionary containing objects that hold User ID parameters. Xandr supports User ID(s) from the below external sources: - Criteo - The Trade Desk - NetID - LiveRamp - UID 2.0 - Publisher Provided Id / PPID (publishers can register their own source via API and can pass the user id) You can set User ID by - - creating an array of ANUserId objects, and - assigning the array of objects to the userId Array property of ANSDKSettings in MobileSDK API. |
BOOL disableIDFVUsage |
Specifies a boolean value which exclude the IDFV field in ad request. Default value of the property is set to NO. Due to introduction of App Tracking Transparency (ATT) changes in iOS 14.5 and above, publishers can use Identifier for Vendors (IDFV) of the device in cases where there is no in-house Publisher First Party ID and Identifier for Advertisers (IDFA) is available. IDFV will be used in cases where both IDFV and Publisher First Party ID are not present for a given ad request. |
Note
- Publisher ID and User ID are global settings.
- It is sufficient to set the User ID(s) once per app session as these values would be used in all consecutive ad requests in the same session.
- Xandr does not store these values across different app sessions.
Example
// User Id from External Third Party Sources
NSMutableArray<ANUserId *> *userIdArray = [[NSMutableArray<ANUserId *> alloc] init];
[userIdArray addObject:[[ANUserId alloc] initWithANUserIdSource:ANUserIdSourceNetId userId:@"userid-netid-foobar" ]];
[userIdArray addObject:[[ANUserId alloc] initWithANUserIdSource:ANUserIdSourceTheTradeDesk userId:@"userid-ttd-foobar" ]];
ANSDKSettings.sharedInstance().disableIDFAUsage = true[userIdArray addObject:[[ANUserId alloc] initWithANUserIdSource:ANUserIdSourceUID2 userId:@"userid-uid2-foobar" ]];
[userIdArray addObject:[[ANUserId alloc] initWithANUserIdSource:ANUserIdSourceCriteo userId:@"userid-Criteo-foobar"]];
[userIdArray addObject:[[ANUserId alloc] initWithANUserIdSource:ANUserIdSourceLiveRamp userId:@"userid-liveramp-foobar" ]];
[userIdArray addObject:[[ANUserId alloc] initWithStringSource:@"Generic Source" userId:@"userid-generic-foobar" isFirstParytId:true]];
ANSDKSettings.sharedInstance.userIdArray = userIdArray;
// Publisher User Id
ANSDKSettings.sharedInstance.publisherUserId = @"foobar-publisherfirstpartyid";
// IDFV as Publisher User Id
ANSDKSettings.sharedInstance.disableIDFVUsage = NO;
Support for overriding country codes and zip codes
The SDK uses City/DMA/Country information from standard feed (log level data) for reporting purposes. However, these values need to be overwritten from reverser geocoded latitude and longitude data to keep the data sanity intact. If those values are not overwritten, log level data will point to the IP-address based locations and eventually will project wrong data set, especially with mobile data.
Property | Description |
---|---|
NSString *geoOverrideCountryCode |
Indicates a string value to override country code. |
NSString *geoOverrideZipCode |
Indicates a string value to override zip code. |
Example
//Set
ANSDKSettings.sharedInstance.geoOverrideCountryCode = @"US";
ANSDKSettings.sharedInstance.geoOverrideZipCode = @"10010";
.......
//Get
NSString* countryCode = ANSDKSettings.sharedInstance.geoOverrideCountryCode;
NSString* zipCode = ANSDKSettings.sharedInstance.geoOverrideZipCode
Location controls
Property | Description |
---|---|
(void)setLocationWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude timestamp:(nullable NSDate *)timestamp horizontalAccuracy:(CGFloat)horizontalAccuracy precision:(NSInteger)precision |
Method to control how accurate the location data is that you pass to the ad server. Better location data may lead to better monetization of your ads. |
BOOL locationEnabledForCreative |
Property to control the location access for creatives. Default is YES. NO disables the location from the creative. Creatives rendered in a WebView can access a user's location through HTML5 location APIs. Note: - By default, when a creative asks for location, a popup is displayed to the users asking for explicit permission to use the location. - When location access is disabled, popups won't be shown to the users and the creative will receive a PERMISSION_DENIED error for HTML5 location API calls. |
The precision
parameter will cause all location information to be internally rounded to the specified number of digits after the decimal before being passed to the ad server. The correlation between the value of precision
and location accuracy distance is as follows:
Precision (Integer) | Resolution Accuracy |
---|---|
2 | Approx. 1 kilometer |
3 | Approx. 100 meters |
4 | Approx. 10 meters |
-1 | Full resolution is passed |
Example
CLLocation *location = [locationManager location];
NSDate *now = [NSDate date];
[banner.setLocationWithLatitude:location.coordinate.latitude
longitude:location.coordinate.longitude
timestamp: now
horizontalAccuracy: location.horizontal_accuracy
precision: 4];
Publisher side user opt-out
For any AdRequest, Xandr Mobile SDK checks in the device or OS environment level and populates the value for limitAdTracking (LMT) in the background automatically. If LMT=true, it indicates that the user opts out from tracking at the device or OS settings. However, the publishers retain information about their users' opt-in/out of tracking and thus are required to pass that information if their user has opted out to comply with their privacy regulations. To facilitate this, publisher side user opt-out feature has been introduced to the Mobile SDK.
Property | Description |
---|---|
BOOL doNotTrack |
Indicates if you have information in the app about user opt-out. If set to YES, tracking cookies and IDFA will be disabled for all future auctions. Default value is NO. |
Example
[ANSDKSettings sharedInstance].doNotTrack = YES;
Set IDFA usage
The Identifier for Advertisers (IDFA) is an Apple provided ID to track the users with their consent for advertising purposes by the publishers who have an app on the Apple App Store. An API is introduced in Xandr mobile SDK to enable or disable IDFA usage by including or excluding the IDFA field in the ad request.
Property | Description |
---|---|
BOOL disableIDFAUsage |
Property to exclude the IDFA field in ad request. Default value is NO. |
Example
[ANSDKSettings sharedInstance].disableIDFAUsage = YES;
Set the auction timeout
Property | Description |
---|---|
NSUInteger auctionTimeout |
Sets the time period, in milliseconds, to wait for a bidder to respond to a bid request. If the bidder fails to respond within the value set for time out period (for example, 500 milliseconds), the bid request would result in failure. |
Example
[[ANSDKSettings sharedInstance] setAuctionTimeout:500];
Set test mode
Property | Description |
---|---|
BOOL enableTestMode |
Sets YES or NO for the AdRequests to be executed in the test mode for debugging or testing. Default value is NO. Note: The scope of setting the test mode for AdRequest execution as YES is limited to debugging/development or testing purpose only, and not to be used in a production environment. Enabling the test mode in a production environment leads to unintended consequences and impacts the monetization of your app. |
Example
ANSDKSettings.sharedInstance.enableTestMode = YES;
OMID Optimization
The IAB's Open Measurement SDK (OM SDK) enhances third party ad viewability and verification measurement in mobile apps by allowing publishers to use a single SDK, eliminating the need for multiple SDKs. For more details, visit the IAB OM SDK page.
To address reported performance issues when using OMSDK for viewability measurement, we’ve introduced an OMID optimization option, which is off by default. Enabling this option causes the stopOMIDAdSession function to trigger when 100% of the ad is on screen. This improves app performance but reduces the duration of ad viewability measurement.
Property | Description |
---|---|
BOOL enableOMIDOptimization |
Set YES or NO for the OMID Optimization to be enabled. Default value is NO. Note: This API supports only banner and native ad types. |
Example
ANSDKSettings.sharedInstance.enableOMIDOptimization = true;
Set content language
Property | Description |
---|---|
NSString *contentlanguage |
Sets the two-letter ANSI code for the content's language; for example, EN . |
Example
ANSDKSettings.sharedInstance.contentLanguage = @"EN";