Target Methods

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

The SDK currently has support for multiple Adobe Marketing Cloud Solutions, including Analytics, Target, Audience Manager, and the Marketing Cloud Visitor ID Service. Methods are prefixed according to the solution. For example, Target methods are prefixed with target.

Tip: Lifecycle Metrics are sent as parameters to each mbox load.

Class Reference : ADBTargetLocationRequest

Properties

NSString *name;
NSString *defaultContent;
NSMutableDictionary *parameters;

String Constants

Tip: The following constants are for ease of use when you set keys for custom parameters.
NSString *const ADBTargetParameterOrderId;
NSString *const ADBTargetParameterOrderTotal;
NSString *const ADBTargetParameterProductPurchasedId;
NSString *const ADBTargetParameterCategoryId;
NSString *const ADBTargetParameterMbox3rdPartyId;
NSString *const ADBTargetParameterMboxPageValue;
NSString *const ADBTargetParameterMboxPc;
NSString *const ADBTargetParameterMboxSessionId;
NSString *const ADBTargetParameterMboxHost;
Method Description

targetLoadRequest:​callback:

Sends request to your configured Target server and returns the string value of the offer that is generated in a block callback.

Syntax:

+ (void) targetLoadRequest:(ADBTargetLocationRequest *)request 
                  callback:(void (^)(NSString *content))callback;

Example:

[ADBMobile targetLoadRequest:myRequest 
                    callback:^(NSString *content) {
                        // do something with content
                    }];

targetLoadRequestWithName:defaultContent:profileParameters:orderParameters:mboxParameters:requestLocationParameters:callback:

Sends a request to your configured Target server and returns the string value of the offer that is generated in a block callback.

Syntax:

+ (void) targetLoadRequestWithName:(nullable NSString *)name
                    defaultContent:(nullable NSString *)defaultContent
                 profileParameters:(nullable NSDictionary *)profileParameters
                   orderParameters:(nullable NSDictionary *)orderParameters
                    mboxParameters:(nullable NSDictionary *)mboxParameters
         requestLocationParameters:(nullable NSDictionary *)requestLocationParameters
                          callback:(nullable void (^)(NSString* __nullable content))callback;

Returns: N/A

Parameters:

Name: Description:

name

Type: NSString *

Name of the Target mbox/location that you want to retrieve.

defaultContent

Type: NSString *

Value returned in the callback if the Target server is unreachable, or the user does not qualify for the campaign.

profileParameters

Type: NSDictionary *

Values in this dictionary will go in the "profileParameters" object in the request to Target.

orderParameters

Type: NSDictionary *

Values in this dictionary will go in the "order" object in the request to Target.

mboxParameters

Type: NSDictionary *

Values in this dictionary will go in the "mboxParameters" object in the request to Target.

requestLocationParameters

Type: NSDictionary *

Values in this dictionary will go in the "requestLocation" object in the request to Target.

callback

Type: Function

This method will be called with the content of the offer from the Target server. If the Target server is unreachable, or the user does not qualify for the campaign, defaultContent will be returned.

Example:

[ADBMobile targetLoadRequestWithName:@"myHeroBanner"
                      defaultContent:@"defaultHeroBanner.png"
                   profileParameters:@{@"age":@"20-29"}
                     orderParameters:nil
                      mboxParameters:@{@"customParam":@"customValue"}
           requestLocationParameters:@{@"host":@"my.hostname.com"}
                            callback:^(NSString *content){ 
                                // do something with content
                                myImageView.image = [UIImage imageNamed:content]; 
                            }];

For more information about the underlying Target API, see the Delivery documentation on the Target Developers website.

targetLoadRequestWithName:defaultContent:profileParameters:orderParameters:mboxParameters:callback:

Sends request to your configured Target server and returns the string value of the offer generated in a block callback.

Syntax:

+ (void) targetLoadRequestWithName:(nullable NSString *)name
				    defaultContent:(nullable NSString *)defaultContent
			     profileParameters:(nullable NSDictionary *)profileParameters
			       orderParameters:(nullable NSDictionary *)orderParameters
			        mboxParameters:(nullable NSDictionary *)mboxParameters
			              callback:(nullable void (^)(NSString* __nullable content))callback;

Example:

[ADBMobile targetLoadRequestWithName:@"mboxName"
			          defaultContent:@"defaultContent"
			       profileParameters:@{@"profile-parameter-key": @"profile-parameter-value"}
				     orderParameters:@{@"order-parameter-key": @"order-parameter-value"}
			          mboxParameters:@{@"mbox-parameter-key": @"mbox-parameter-value"}
					         callback:^(NSString* content) {
					                  //do something with content
			               	}
                           }];

targetCreateOrder​ConfirmRequestWithName:​orderId:​orderTotal:​productPurchasedId:​parameters:

Creates an ADBTargetLocationRequest.

Syntax:

+ (ADBTargetLocationRequest *) 
targetCreateOrderConfirmRequestWithName:(NSString *)name
                                orderId:(NSString *)orderId
                             orderTotal:(NSString *)orderTotal
                     productPurchasedId:(NSString *)productPurchasedId
                             parameters:(NSDictionary *)parameters;

targetCreateRequestWithName:​​defaultContent:​parameters

Convenience constructor to create an ADBTargetLocationRequest object with the given parameters.

Syntax:

+ (ADBTargetLocationRequest *) 
targetCreateRequestWithName:(NSString *)name 
             defaultContent:(NSString *)defaultContent 
                 parameters:(NSDictionary *)parameters;

Example:

ADBTargetLocationRequest *myRequest = 
[ADBMobile targetCreateRequestWithName:@"heroBanner" 
                        defaultContent:@"default.png" 
                            parameters:nil];

targetThirdPartyID

Returns the third-party ID.

Syntax:

+ (nullable NSString *) targetThirdPartyID;

Example:

NSString *thirdPartyId = [ADBMobile targetThirdPartyID];

targetSetThirdPartyID:

Sets the third-party ID.

Syntax:

+ (void) targetSetThirdPartyID:(nullable NSString *)thirdPartyID;

Example:

[ADBMobile targetSetThirdPartyID:@"thirdPartyID"];

targetClearCookies

Clears any target cookies from your app.

Tip: Since version 4.10.0 of the SDK, Target no longer uses cookies. This method resets the thirdPartyID and sessionID.

Syntax:

+ (void) targetClearCookies;

Example:

[ADBMobile targetClearCookies];

targetPcID

Returns the PcID.

Syntax:

+ (nullable NSString *) targetPcID;

Example:

NSString *myTargetPcID = [ADBMobile targetPcID];

targetSessionID

Returns the SessionID.

Syntax:

+ (nullable NSString *) targetPcID;

Example:

NSString *myTargetSessionID = [ADBMobile targetSessionID];

Example:

// make your request
ADBTargetLocationRequest *myRequest = 
	[ADBMobile targetCreateRequestWithName:@"heroBanner" 
	                        defaultContent:@"default.png" 
                             parameters:nil];
// load your request
[ADBMobile targetLoadRequest:myRequest 
                    callback:^(NSString *content) {
                        // do something with content
                       	heroImage.image = [UIImage imageNamed:content];  
                    }];