Skip to content

Latest commit

 

History

History
202 lines (139 loc) · 4.2 KB

adobe-campaign-standard-api-reference.md

File metadata and controls

202 lines (139 loc) · 4.2 KB

Adobe Campaign Standard API reference

extensionVersion

To return the current version of the Campaign extension, use the following APIs:

{% tabs %} {% tab title="Android" %}

Java

Syntax

public String extensionVersion()

Example

Campaign.extensionVersion();

{% endtab %}

{% tab title="iOS" %}

Syntax

+ (nonnull NSString*) extensionVersion;

Examples

Objective C

NSLog(@"ACPCampaign version: %@", [ACPCampaign extensionVersion]);

Swift

print("ACPCampaign version: ", ACPCampaign.extensionVersion())

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

extensionVersion(): Promise<string>

Example

ACPCampaign.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPCampaign version: " + version));

{% endtab %} {% endtabs %}

resetLinkageFields

This method clears the cached rules from the previous download before triggering a rule download request to the configured Campaign server. If the current SDK privacy status is not OPT_IN, no rules download occurs.

{% tabs %} {% tab title="Android" %}

Java

Syntax

public static void resetLinkageFields()

Example

Campaign.resetLinkageFields()

{% endtab %}

{% tab title="iOS" %}

Syntax

+ (void) resetLinkageFields;

Objective C

Example

[ACPCampaign resetLinkageFields];

Swift

ACPCampaign.resetLinkageFields()

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

resetLinkageFields();

Example

ACPCampaign.resetLinkageFields();

{% endtab %} {% endtabs %}

setLinkageFields

This API sets the Campaign linkage fields (CRM IDs) in the Mobile SDK that are used to download personalized messages from Campaign. The set linkage fields are stored as a base64-encoded JSON string in memory, and they are sent in a custom HTTP header X-InApp-Auth in all future Campaign rules download requests until resetLinkageFields is invoked. These in-memory variables are lost in the following scenarios:

  • When an application crash event occurs.
  • After a graceful termination of the application.
  • When the privacy status is updated to OPT_OUT. For more information, see Set and Get Privacy Status

For more information about setting up linkage fields in Campaign, see Extending the subscriptions to an application resource.

{% tabs %} {% tab title="Android" %}

Java

Syntax

public static void setLinkageFields(final Map<String, String> linkageFields)
  • linkageFields is a map that contains the linkage field key-value pairs.

Example

HashMap<String, String> linkageFields = new HashMap<String, String>();
linkageFields.put("cusFirstName", "John");
linkageFields.put("cusLastName", "Doe");
linkageFields.put("cusEmail", "[email protected]");
Campaign.setLinkageFields(linkageFields);

{% endtab %}

{% tab title="iOS" %}

Syntax

+ (void) setLinkageFields: (nonnull NSDictionary<NSString*, NSString*>*) linkageFields;
  • linkageFields is a dictionary that contains the linkage field key-value pairs.

Examples

Objective C

[ACPCampaign setLinkageFields:@{@"cusFirstName" : @"John", @"cusLastName": @"Doe", @"cusEmail": @"[email protected]"}];

Swift

var linkageFields = [String: String]()
linkageFields["cusFirstName"] = "John"
linkageFields["cusLastName"] = "Doe"
linkageFields["cusEmail"] = "[email protected]"
ACPCampaign.setLinkageFields(linkageFields)

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

setLinkageFields(linkageFields: { string: string })
  • linkageFields is a map that contains the linkage field key-value pairs.

Example

ACPCampaign.setLinkageFields({"firstName": "John"});

{% endtab %} {% endtabs %}