Edit in GitHubLog an issue

Java

Syntax

Copied to your clipboard
public static String extensionVersion();

Example

Copied to your clipboard
String extensionVersion = Edge.extensionVersion();

Kotlin

Example

Copied to your clipboard
val extensionVersion = EdgeBridge.extensionVersion()

Swift

Syntax

Copied to your clipboard
static let extensionVersion

Example

Copied to your clipboard
let extensionVersion = Edge.extensionVersion

Objective-C

Syntax

Copied to your clipboard
+ (nonnull NSString*) extensionVersion;

Example

Copied to your clipboard
NSString *extensionVersion = [AEPMobileEdge extensionVersion];

Java

Syntax

Copied to your clipboard
public static void getLocationHint(final AdobeCallback<String> callback)
  • callback is invoked with the location hint. The location hint value may be null if the location hint expired or was not set. The callback may be invoked on a different thread. If AdobeCallbackWithError is provided, the default timeout is 1000ms and the fail method is called if the operation times out or an unexpected error occurs.

Example

Copied to your clipboard
Edge.getLocationHint(new AdobeCallbackWithError<String>() {
@Override
public void call(final String hint) {
// Handle the hint here
}
@Override
public void fail(AdobeError adobeError) {
// Handle the error here
}
});

Kotlin

Example

Copied to your clipboard
Edge.getLocationHint(object: AdobeCallbackWithError<String> {
override fun call(hint: String) {
// Handle the hint here
}
override fun fail(error: AdobeError?) {
// Handle the error here
}
})

Swift

Syntax

Copied to your clipboard
static func getLocationHint(completion: @escaping (String?, Error?) -> Void)
  • completion is invoked with the location hint, or an AEPError if the request times out or an unexpected error occurs. The location hint value may be nil if the location hint expired or was not set. The default timeout is 1000ms. The completion handler may be invoked on a different thread.

Example

Copied to your clipboard
Edge.getLocationHint { (hint, error) in
if let error = error {
// Handle the error here
} else {
// Handle the location hint here
}
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getLocationHint:^(NSString * _Nullable hint, NSError * _Nullable error)completion

Example

Copied to your clipboard
[AEPMobileEdge getLocationHint:^(NSString *hint, NSError *error) {
// handle the error and the hint here
}];

Java

Syntax

Copied to your clipboard
public static void registerExtension();

Example

Copied to your clipboard
Edge.registerExtension();

Swift

Use the MobileCore API to register the Edge extension.

Syntax

Copied to your clipboard
// MobileCore
public static func registerExtensions(_ extensions: [Extension.Type], _ completion: (() -> Void)? = nil)

Example

Copied to your clipboard
import AEPEdge
...
MobileCore.registerExtensions([Edge.self, ...], {
// Processing after registration
})

Objective-C

Use the AEPMobileCore API to register the Edge extension.

Syntax

Copied to your clipboard
+ (void) registerExtensions: (NSArray<Class*>* _Nonnull) extensions
completion: (void (^ _Nullable)(void)) completion;

Example

Copied to your clipboard
@import AEPEdge;
[AEPMobileCore registerExtensions:@[AEPMobileEdge.class] completion:nil];...

Java

Syntax

Copied to your clipboard
public static void sendEvent(final ExperienceEvent experienceEvent,
final EdgeCallback callback);
  • experienceEvent - the XDM Experience Event to be sent to Adobe Experience Platform Edge Network
  • completion - optional callback to be invoked when the request is complete, returning the associated EdgeEventHandle(s) received from the Adobe Experience Platform Edge Network. It may be invoked on a different thread.

Example

Copied to your clipboard
// Create Experience Event from map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build();
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
Edge.sendEvent(experienceEvent, null);
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});
Example with Datastream ID override
Copied to your clipboard
// Create experience event from Map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamIdOverride("SampleDatastreamId")
.build();
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});
Example with Datastream config override
Copied to your clipboard
// ----------------- Datastream config overrides map start -----------------
Map<String, Object> configOverrides = new HashMap<>();
// com_adobe_experience_platform
Map<String, Object> experiencePlatform = new HashMap<>();
Map<String, Object> datasets = new HashMap<>();
Map<String, Object> eventDataset = new HashMap<>();
eventDataset.put("datasetId", "SampleEventDatasetIdOverride");
datasets.put("event", eventDataset);
experiencePlatform.put("datasets", datasets);
configOverrides.put("com_adobe_experience_platform", experiencePlatform);
// com_adobe_analytics
Map<String, Object> analytics = new HashMap<>();
analytics.put("reportSuites", new String[]{"rsid1", "rsid2", "rsid3"});
configOverrides.put("com_adobe_analytics", analytics);
// com_adobe_identity
Map<String, Object> identity = new HashMap<>();
identity.put("idSyncContainerId", "1234567");
configOverrides.put("com_adobe_identity", identity);
// com_adobe_target
Map<String, Object> target = new HashMap<>();
target.put("propertyToken", "SamplePropertyToken");
configOverrides.put("com_adobe_target", target);
// ----------------- Datastream config overrides map end -----------------
// Create experience event from Map
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamConfigOverride(configOverrides)
.build();
Edge.sendEvent(experienceEvent, new EdgeCallback() {
@Override
public void onComplete(final List<EdgeEventHandle> handles) {
// Handle the Edge Network response
}
});

Kotlin

Example

Copied to your clipboard
// Create Experience Event from map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build()
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
Edge.sendEvent(experienceEvent, null)
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}
Example with Datastream ID override
Copied to your clipboard
// Create experience event from Map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamIdOverride("SampleDatastreamId")
.build()
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}
Example with Datastream config override
Copied to your clipboard
// Create experience event from Map
val xdmData = mutableMapOf<String, Any>()
xdmData["eventType"] = "SampleXDMEvent"
xdmData["sample"] = "data"
val configOverrides = mapOf(
"com_adobe_experience_platform" to mapOf(
"datasets" to mapOf(
"event" to mapOf("datasetId" to "SampleEventDatasetIdOverride")
)
),
"com_adobe_analytics" to mapOf(
"reportSuites" to listOf("rsid1", "rsid2", "rsid3")
),
"com_adobe_identity" to mapOf(
"idSyncContainerId" to "1234567"
),
"com_adobe_target" to mapOf(
"propertyToken" to "SamplePropertyToken"
)
)
val experienceEvent = ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setDatastreamConfigOverride(configOverrides)
.build()
Edge.sendEvent(experienceEvent) {
// Handle the Edge Network response
}

Swift

Syntax

Copied to your clipboard
static func sendEvent(experienceEvent: ExperienceEvent, _ completion: (([EdgeEventHandle]) -> Void)? = nil)
  • experienceEvent - the XDM Experience Event to be sent to Adobe Experience Platform Edge Network
  • completion - optional callback to be invoked when the request is complete, returning the associated EdgeEventHandle(s) received from the Adobe Experience Platform Edge Network. It may be invoked on a different thread.

Example

Copied to your clipboard
// Create Experience Event from dictionary:
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
"sample": "data"]
let experienceEvent = ExperienceEvent(xdm: xdmData)
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
Edge.sendEvent(experienceEvent: experienceEvent)
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
Edge.sendEvent(experienceEvent: experienceEvent) { (handles: [EdgeEventHandle]) in
// Handle the Edge Network response
}
Example with Datastream ID override
Copied to your clipboard
// Create Experience event from dictionary
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
"sample": "data"]
let experienceEvent = ExperienceEvent(xdm: xdmData, datastreamIdOverride: "SampleDatastreamId")
Edge.sendEvent(experienceEvent: experienceEvent) { (handles: [EdgeEventHandle]) in
// Handle the Edge Network response
}
Example with Datastream config override
Copied to your clipboard
// Create Experience event from dictionary
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
"sample": "data"]
let configOverrides: [String: Any] = [
"com_adobe_experience_platform": [
"datasets": [
"event": [
"datasetId": "SampleEventDatasetIdOverride"
]
]
],
"com_adobe_analytics": [
"reportSuites": [
"rsid1",
"rsid2",
"rsid3"
]
],
"com_adobe_identity": [
"idSyncContainerId": "1234567"
],
"com_adobe_target": [
"propertyToken": "SamplePropertyToken"
]
]
let experienceEvent = ExperienceEvent(xdm: xdmData, datastreamConfigOverride: configOverrides)
Edge.sendEvent(experienceEvent: experienceEvent) { (handles: [EdgeEventHandle]) in
// Handle the Edge Network response
}

Objective-C

Syntax

Copied to your clipboard
+ (void) sendExperienceEvent:(AEPExperienceEvent * _Nonnull) completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull)completion

Example

Copied to your clipboard
// Create Experience Event from dictionary:
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
NSDictionary *data = @{ @"sample" : @"data"};
Copied to your clipboard
// Example 1 - send the Experience Event without handling the Edge Network response
[AEPMobileEdge sendExperienceEvent:event completion:nil];
Copied to your clipboard
// Example 2 - send the Experience Event and handle the Edge Network response onComplete
[AEPMobileEdge sendExperienceEvent:event completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull handles) {
// handle the Edge Network response
}];
Example with Datastream ID override
Copied to your clipboard
// Create Experience event from dictionary:
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
NSDictionary *data = @{ @"sample" : @"data"};
AEPExperienceEvent* event = [[AEPExperienceEvent alloc]initWithXdm:xdmData data:data datastreamIdOverride: @"SampleDatastreamIdOverride"];
[AEPMobileEdge sendExperienceEvent:event completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull handles) {
// Handle the Edge Network response
}];
Example with Datastream config override
Copied to your clipboard
// Create Experience event from dictionary:
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
NSDictionary *data = @{ @"sample" : @"data"};
NSDictionary *configOverrides = @{ @"com_adobe_experience_platform" : @{
@"datasets" : @{
@"event" : @{
@"datasetId": @"SampleEventDatasetIdOverride"
}
}
},
@"com_adobe_analytics" : @{
@"reportSuites" : @[
@"rsid1",
@"rsid2",
@"rsid3",
]
},
@"com_adobe_identity" : @{
@"idSyncContainerId": @"1234567"
},
@"com_adobe_target" : @{
@"propertyToken": @"SamplePropertyToken"
}
}
AEPExperienceEvent* event = [[AEPExperienceEvent alloc]initWithXdm:xdmData data:data datastreamConfigOverride: configOverrides];
[AEPMobileEdge sendExperienceEvent:event completion:^(NSArray<AEPEdgeEventHandle *> * _Nonnull handles) {
// Handle the Edge Network response
}];

Java

Syntax

Copied to your clipboard
public static void setLocationHint(final String hint)
  • hint the Edge Network location hint to use when connecting to the Adobe Experience Platform Edge Network.

Example

Copied to your clipboard
Edge.setLocationHint(hint);

Kotlin

Example

Copied to your clipboard
Edge.setLocationHint(hint)

Swift

Syntax

Copied to your clipboard
@objc(setLocationHint:)
public static func setLocationHint(_ hint: String?)
  • hint the Edge Network location hint to use when connecting to the Adobe Experience Platform Edge Network.

Example

Copied to your clipboard
Edge.setLocationHint(hint)

Objective-C

Syntax

Copied to your clipboard
+ (void) setLocationHint: (NSString * _Nullable hint);

Example

Copied to your clipboard
[AEPMobileEdge setLocationHint:hint];

Java

Copied to your clipboard
/**
* The interface that represents an Experience XDM event data schema.
*/
public interface Schema {
/**
* Returns the version of this schema as defined in the Adobe Experience Platform.
* @return the version of this schema.
*/
String getSchemaVersion();
/**
* Returns the identifier for this schema as defined in the Adobe Experience Platform.
* The identifier is a URI where this schema is defined.
* @return the URI identifier for this schema.
*/
String getSchemaIdentifier();
/**
* Returns the identifier for this dataset as defined in the Adobe Experience Platform.
* @return the dataset ID
*/
String getDatasetIdentifier();
/**
* Serialize this {@code Schema} object to a map with the same format as its XDM schema.
* @return the XDM-formatted map of this {@code Schema} object.
*/
Map<String, Object> serializeToXdm();
}

By implementing the Property interface, you can define complex properties for your XDM Schema. A complex property is defined as not being a primitive type, String, or Date.

Copied to your clipboard
public interface Property {
/**
* Serialize this {@code Property} object to a map with the same format as its XDM schema.
* @return XDM-formatted map of this {@code Property} object.
*/
Map<String, Object> serializeToXdm();
}

When defining your custom XDM schema(s), implement these interfaces to ensure that the AEP Edge extension successfully serializes the provided data before sending it to Adobe Experience Platform Edge Network.

Swift

Copied to your clipboard
/// An interface representing a Platform XDM Event Data schema.
public protocol XDMSchema: Encodable {
/// Returns the version of this schema as defined in the Adobe Experience Platform.
/// - Returns: The version of this schema
var schemaVersion: String { get }
/// Returns the identifier for this schema as defined in the Adobe Experience Platform.
/// The identifier is a URI where this schema is defined.
/// - Returns: The URI identifier for this schema
var schemaIdentifier: String { get }
/// Returns the identifier for this dataset as defined in the Adobe Experience Platform.
/// This is a system generated identifier for the Dataset the event belongs to.
/// - Returns: The identifier as a String for this dataset
var datasetIdentifier: String { get }
}

Java

Copied to your clipboard
/**
* The {@link EdgeEventHandle} is a response fragment from Adobe Experience Edge Service for a sent XDM Experience Event.
* One event can receive none, one or multiple {@link EdgeEventHandle}(s) as response.
*/
public class EdgeEventHandle {
/**
* @return the payload type or null if not found in the {@link JSONObject} response
*/
public String getType() {...}
/**
* @return the event payload values for this {@link EdgeEventHandle} or null if not found in the {@link JSONObject} response
*/
public List<Map<String, Object>> getPayload() {...}
}

Swift

Copied to your clipboard
@objc(AEPEdgeEventHandle)
public class EdgeEventHandle: NSObject, Codable {
/// Payload type
@objc public let type: String?
/// Event payload values
@objc public let payload: [[String: Any]]?
}

Java

Copied to your clipboard
public final class ExperienceEvent {
public static class Builder {
...
public Builder() {
...
}
/**
* Sets free form data associated with this event to be passed to Adobe Experience Edge.
*
* @param data free form data, JSON like types are accepted
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setData(final Map<String, Object> data) {...}
/**
* Solution specific XDM event data for this event.
*
* @param xdm {@link Schema} information
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Schema xdm) {...}
/**
* Solution specific XDM event data and dataset identifier for this event.
*
* @param xdm {@code Map<String, Object>} of raw XDM schema data
* @param datasetIdentifier The Experience Platform dataset identifier where this event is sent.
* If not provided, the default dataset defined in the configuration ID is used
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Map<String, Object> xdm, final String datasetIdentifier) {...}
/**
* Solution specific XDM event data for this event, passed as raw mapping of keys and
* Object values.
*
* @param xdm {@code Map<String, Object>} of raw XDM schema data
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setXdmSchema(final Map<String, Object> xdm) {...}
/**
* Override the default datastream identifier to send this event's data to a different datastream.
*
* When using {@link Edge#sendEvent}, this event is sent to the Experience Platform using the
* datastream identifier {@code datastreamIdOverride} instead of the default Experience Edge
* configuration ID set in the SDK Configuration key {@code edge.configId}.
*
* @param datastreamIdOverride Datastream identifier to override the default datastream identifier set in the Edge configuration
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*
*/
public Builder setDatastreamIdOverride(final String datastreamIdOverride) {...}
/**
* Override the default datastream configuration settings for individual services for this event.
*
* When using {@link Edge#sendEvent}, this event is sent to the Experience Platform along with the
* datastream overrides defined in {@code datastreamConfigOverride}.
*
* @param datastreamConfigOverride Map defining datastream configuration overrides for this Experience Event
* @return instance of current builder
* @throws UnsupportedOperationException if this instance was already built
*/
public Builder setDatastreamConfigOverride(final Map<String, Object> datastreamConfigOverride) {...}
/**
* Builds and returns a new instance of {@code ExperienceEvent}.
*
* @return a new instance of {@code ExperienceEvent} or null if one of the required parameters is missing
* @throws UnsupportedOperationException if this instance was already built
*/
public ExperienceEvent build() {...}
}
public Map<String, Object> getData() {...}
public Map<String, Object> getXdmSchema() {...}
public String getDatastreamIdOverride() {...}
public Map<String, Object> getDatastreamConfigOverride() {...}
}

Examples

Copied to your clipboard
// Example 1
// Create Experience Event with both XDM and freeform data using maps
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
Map<String, Object> data = new HashMap<>();
data.put("free", "form");
data.put("data", "example");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.setData(data)
.build();
Copied to your clipboard
// Example 2
// Create Experience Event from XDM Schema implementation
public class XDMSchemaExample implements com.adobe.marketing.mobile.xdm.Schema {
private String eventType;
private String otherField;
...
public String getEventType() {
return this.eventType;
}
public void setEventType(final String newValue) {
this.eventType = newValue;
}
public String getOtherField() {
return this.otherField;
}
public void setOtherField(final String newValue) {
this.otherField = newValue;
}
}
// Create Experience Event from Schema
XDMSchemaExample xdmData = new XDMSchemaExample();
xdmData.setEventType("SampleXDMEvent");
xdmData.setOtherField("OtherFieldValue");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData)
.build();
Copied to your clipboard
// Example 3
// Set the destination Dataset identifier to the current Experience Event
Map<String, Object> xdmData = new HashMap<>();
xdmData.put("eventType", "SampleXDMEvent");
xdmData.put("sample", "data");
ExperienceEvent experienceEvent = new ExperienceEvent.Builder()
.setXdmSchema(xdmData, "datasetIdExample")
.build();
Copied to your clipboard
@objc(AEPExperienceEvent)
public class ExperienceEvent: NSObject {
/// XDM formatted data, use an `XDMSchema` implementation for a better XDM data injection and format control
@objc public let xdm: [String: Any]?
/// Optional free-form data associated with this event
@objc public let data: [String: Any]?
/// Datastream identifier used to override the default datastream identifier set in the Edge configuration for this event
@objc public private(set) var datastreamIdOverride: String?
/// Datastream configuration used to override individual settings from the default datastream configuration for this event
@objc public private(set) var datastreamConfigOverride: [String: Any]?
/// Adobe Experience Platform dataset identifier, if not set the default dataset identifier set in the Edge Configuration is used
@objc public let datasetIdentifier: String?
/// Initialize an Experience Event with the provided event data
/// - Parameters:
/// - xdm: XDM formatted data for this event, passed as a raw XDM Schema data dictionary.
/// - data: Any free form data in a [String : Any] dictionary structure.
@objc public init(xdm: [String: Any], data: [String: Any]? = nil) {...}
/// Initialize an Experience Event with the provided event data
/// - Parameters:
/// - xdm: XDM formatted data for this event, passed as a raw XDM Schema data dictionary.
/// - data: Any free form data in a [String : Any] dictionary structure.
/// - datasetIdentifier: The Experience Platform dataset identifier where this event should be sent to; if not provided, the default dataset identifier set in the Edge configuration is used
@objc public convenience init(xdm: [String: Any], data: [String: Any]? = nil, datasetIdentifier: String? = nil) {...}
/// Initialize an Experience Event with the provided event data
/// - Parameters:
/// - xdm: XDM formatted data for this event, passed as a raw XDM Schema data dictionary.
/// - data: Any free form data in a [String : Any] dictionary structure.
/// - datastreamIdOverride: Datastream identifier used to override the default datastream identifier set in the Edge configuration for this event.
/// - datastreamConfigOverride: Datastream configuration used to override individual settings from the default datastream configuration for this event.
@objc public convenience init(xdm: [String: Any], data: [String: Any]? = nil, datastreamIdOverride: String? = nil, datastreamConfigOverride: [String: Any]? = nil) {...}
/// Initialize an Experience Event with the provided event data
/// - Parameters:
/// - xdm: XDM formatted event data passed as an XDMSchema
/// - data: Any free form data in a [String : Any] dictionary structure.
public init(xdm: XDMSchema, data: [String: Any]? = nil) {...}
/// Initialize an Experience Event with the provided event data
/// - Parameters:
/// - xdm: XDM formatted event data passed as an XDMSchema
/// - data: Any free form data in a [String : Any] dictionary structure.
/// - datastreamIdOverride: Datastream identifier used to override the default datastream identifier set in the Edge configuration for this event.
/// - datastreamConfigOverride: Datastream configuration used to override individual settings from the default datastream configuration for this event.
public convenience init(xdm: XDMSchema, data: [String: Any]? = nil, datastreamIdOverride: String? = nil, datastreamConfigOverride: [String: Any]? = nil) {...}
}

Swift

Examples

Copied to your clipboard
// Example 1
// Create Experience Event with both XDM and freeform data using dictionaries
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
"sample": "data"]
let experienceEvent = ExperienceEvent(xdm: xdmData, data: ["free": "form", "data": "example"])
Copied to your clipboard
// Example 2
// Create Experience Event from XDM Schema implementation
import AEPEdge
public struct XDMSchemaExample : XDMSchema {
public let schemaVersion = "1.0" // Returns the version of this schema as defined in the Adobe Experience Platform.
public let schemaIdentifier = "" // The URI identifier for this schema
public let datasetIdentifier = "" // The identifier for the Dataset this event belongs to.
public init() {}
public var eventType: String?
public var otherField: String?
enum CodingKeys: String, CodingKey {
case eventType = "eventType"
case otherField = "otherField"
}
}
extension XDMSchemaExample {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
if let unwrapped = eventType { try container.encode(unwrapped, forKey: .eventType) }
if let unwrapped = otherField { try container.encode(unwrapped, forKey: .otherField) }
}
}
...
// Create Experience Event from XDMSchema
var xdmData = XDMSchemaExample()
xdmData.eventType = "SampleXDMEvent"
xdm.otherField = "OtherFieldValue"
let event = ExperienceEvent(xdm: xdmData)
Copied to your clipboard
// Example 3
// Set the destination Dataset identifier to the current Experience Event
var xdmData : [String: Any] = ["eventType" : "SampleXDMEvent",
"sample": "data"]
let experienceEvent = ExperienceEvent(xdm: xdmData, datasetIdentifier: "datasetIdExample")

Objective-C

Examples

Copied to your clipboard
// Example 1
// Create Experience Event with both XDM and freeform data using dictionaries
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
NSDictionary *data = @{ @"sample" : @"data"};
AEPExperienceEvent* event = [[AEPExperienceEvent alloc]initWithXdm:xdmData data:data];
Copied to your clipboard
// Example 2
// Set the destination Dataset identifier to the current Experience Event
NSDictionary *xdmData = @{ @"eventType" : @"SampleXDMEvent"};
AEPExperienceEvent *event = [[AEPExperienceEvent alloc] initWithXdm:xdmData data:nil datasetIdentifier:@"datasetIdExample"];
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2025 Adobe. All rights reserved.