Configuration Methods

Here is a list of methods that are provided by the iOS library.

The SDK currently has support for multiple Adobe Experience Cloud Solutions, including Analytics, Target, Audience Manager, and the Experience Cloud ID service.

Method Description

setAppExtensionType

Configures the Adobe Mobile SDK setting to determine what kind of extension is currently being executed.

Set to one of the following values:
  • ADBMobileAppExtensionTypeRegular - extension is bundled with a containing app
  • ADBMobileAppExtensionTypeStandAlone - extension is not bundled with a containing app
Tip: This method should only be used if your app has an extension or is a stand-alone extension. For more information, see ADBMobileAppExtensionType.

Syntax:

+ (void) setAppExtensionType:(ADBMobileAppExtensionType)type;

Example:

[ADBMobile setAppExtensionType:ADBMobileAppExtensionTypeStandAlone];

version

Returns the current version of the Adobe Mobile library.

Syntax:

+ (NSString *) version;

Example:

NSString *libraryVersion = [ADBMobile version];

privacyStatus

Returns the enum representation of the privacy status for current user:
  • ADBMobilePrivacyStatusOptIn - hits are sent immediately.
  • ADBMobilePrivacyStatusOptOut - hits are discarded.
  • ADBMobilePrivacyStatusUnknown - If offline tracking is enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offline tracking is not enabled, hits are discarded until the privacy status changes to opt in.

The default value is set in ADBMobileConfig.json.

Syntax:

+ (ADBMobilePrivacyStatus) privacyStatus;

Example:

ADBMobilePrivacyStatus privacyStatus = [ADBMobile privacyStatus];

setPrivacyStatus:

Sets the privacy status for the current user to status.

Set to one of the following values:
  • ADBMobilePrivacyStatusOptIn - hits are sent immediately.
  • ADBMobilePrivacyStatusOptOut - hits are discarded.
  • ADBMobilePrivacyStatusUnknown - If offline tracking is enabled, hits are saved until the privacy status changes to opt-in (then hits are sent) or opt-out (then hits are discarded). If offline tracking is not enabled, hits are discarded until the privacy status changes to opt in.

Syntax:

+ (void) setPrivacyStatus:(ADBMobilePrivacyStatus)status;

Example:

[ADBMobile setPrivacyStatus:ADBMobilePrivacyStatusOptIn];

lifetimeValue

Returns the lifetime value of the current user.

Default: 0

Syntax:

+ (NSDecimalNumber *) lifetimeValue;

Example:

NSDecimalNumber *lifeValue = [ADBMobile lifetimeValue];

trackingIdentifier

Returns the automatically generated visitor identifier. This is an app-specific unique visitor ID that is generated by Adobe’s servers. If Adobe's servers cannot be reached at the time of generation, then the ID is generated using Apple's CFUUID. The value is generated at the initial launch and is stored and used from that point forward. This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

Tip: If your app upgrades from the Experience Cloud 3.x to the 4.x SDK, the previous custom or automatically generated visitor ID is retrieved and stored as the custom user identifier. For more information, see the userIdentifier row below.

This preserves visitor data between SDK upgrades. For new installations on the 4.x SDK, the user identifier is nil and tracking identifier is used.

Syntax:

+ (NSString *) trackingIdentifier;

Example:

NSString *tid = [ADBMobile trackingIdentifier];

userIdentifier

If a custom identifier has been set, the user identifier is returned. If a custom identifier is not set, nil is returned.

Default: nil

Tip: If your app upgrades from the Experience Cloud 3.x to 4.x SDK, the previous custom or automatically generated visitor ID is retrieved and stored as the custom user identifier. This preserves visitor data between upgrades of the SDK.

For new installations on the 4.x SDK, the user identifier is nil until set.

Syntax:

+ (NSString *) userIdentifier;

Example:

NSString *uid = [ADBMobile userIdentifier];

setUserIdentifier:

Sets the user identifier to identifier.

Syntax:

+ (void) setUserIdentifier:(NSString *)identifier;

Example:

[ADBMobile setUserIdentifier:@"billybob"];

debugLogging

Returns the current debug logging preference.

Default: NO

Syntax:

+ (BOOL) debugLogging;

Example:

BOOL debugging = [ADBMobile debugLogging];

setDebugLogging:

Sets the debug logging preference to debug.

Syntax:

+ (void) setDebugLogging:(BOOL)debug;

Example:

[ADBMobile setDebugLogging:YES];

keepLifecycleSessionAlive

Indicates to the SDK that your next resume from background should not start a new session, regardless of the value of lifecycle session timeout in your config file.

Tip: This method is intended to be used for apps that register for notifications while in background and should only be called from the code that runs while your app is in the background.

Syntax:

+ (void) keepLifecycleSessionAlive;

Example:

[ADBMobile keepLifecycleSessionAlive];

collectLifecycleData

Indicates to the SDK that lifecycle data should be collected for use across all solutions in the SDK. See Lifecycle Metrics.

Tip: The preferred location to invoke this method is in application:didFinishLaunchingWithOptions:

Syntax:

+ (void) collectLifecycleData;

Example:

[ADBMobile collectLifecycleData];

collectLifecycleDataWithAdditionalData:

Important: To use collectLifecycleDataWithAdditionalData:, you must have SDK version 4.4 or later.

Allows you to pass in additional data when collecting lifecycle metrics.

Tip: This method must be called from the entry point of your app. Where applicable, this may include one or both of the methods application:didFinishLaunchingWithOptions: and/or applicationWillEnterForeground: in your AppDelegate class.
Important: Data that is passed to the SDK via collectLifecycleDataWithAdditionalData: will be persisted by the SDK in NSUserDefaults. The SDK will strip values in the NSDictionary parameter that are not of type NSString or NSNumber.

Syntax:

+ (void) collectLifecycleDataWithAdditionalData:(nullable NSDictionary *)data;

Example:

[ADBMobile collectLifecycleDataWithAdditionalData:@{@"entryType":@"appShortcutIcon"}];

overrideConfigPath

Important: To use overrideConfigPath , you must have SDK version 4.2 or later.

Lets you load a different ADBMobile JSON config file when the application starts. The different configuration is used until the application is closed.

Syntax:

+ (void) overrideConfigPath: (nullable NSString *) path;

Example:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"ExampleJSONFile" ofType:@"json"];
[ADBMobile overrideConfigPath:filePath];

setPushIdentifier

Sets the device token for push notifications.

Important: This method should only be used in the application:didRegisterForRemoteNotificationsWithDeviceToken: method.

Syntax:

+ (void) setPushIdentifier:(NSData *)deviceToken;

Example:

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [ADBMobile setPushIdentifier:deviceToken]; 
}

setAdvertisingIdentifier

Sets the IDFA in the SDK. If the IDFA has been set in the SDK, the IDFA will be sent in lifecycle. It can also be accessed in Signals (Postbacks).

Tip: Retrieve the IDFA from Apple APIs only if you are using an ad service. If you retrieve IDFA, and are not using it properly, your app might be rejected.

Syntax:

+ (void) setAdvertisingIdentifier:(NSString *)identifier;

Example:

NSString *idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
[ADBMobile setAdvertisingIdentifier:idfa];

ADBMobileAppExtensionType enum

/**
 * @brief An enum type.
 * The possible types of app extension you might use
 * @see setAppExtensionType
 */
typedef NS_ENUM(NSUInteger, ADBMobileAppExtensionType) {
	ADBMobileAppExtensionTypeRegular	= 0, /*!< Enum value ADBMobileAppExtensionTypeRegular. */
	ADBMobileAppExtensionTypeStandAlone	= 1 /*!< Enum value ADBMobileAppExtensionTypeStandAlone. */
};