ContentCard - DEPRECATED
Notice of deprecation
ContentCard
classes are deprecated as of v5.2.0
(iOS) and v3.2.0
(Android). They will be removed in the next major release of the Messaging extension.
An object representing the default content card created in the Adobe Journey Optimizer UI.
Content cards must be rendered by the app developer. Tracking a content card is done via calls to the track(_:withEdgeEventType:)
API.
iOS Interface
Copied to your clipboard@objc(AEPContentCard)@objcMemberspublic class ContentCard: NSObject, Codable {/// Plain-text title for the content cardpublic let title: String/// Plain-text body representing the content for the content cardpublic let body: String/// String representing a URI that contains an image to be used for this content cardpublic let imageUrl: String?/// Contains a URL to be opened if the user interacts with the content cardpublic let actionUrl: String?/// Required if `actionUrl` is provided. Text to be used in title of button or link in content cardpublic let actionTitle: String?...}
Public functions
track(_:withEdgeEventType:)
Tracks an interaction with the given ContentCard
.
Syntax
Copied to your clipboardpublic func track(_ interaction: String? = nil, withEdgeEventType eventType: MessagingEdgeEventType)
Parameters
- interaction - a custom
String
value to be recorded in the interaction - eventType - the
MessagingEdgeEventType
to be used for the ensuing Edge Event
Example
Copied to your clipboardvar contentCard: ContentCard// tracking a displaycontentCard.track(withEdgeEventType: .display)// tracking a user interactioncontentCard.track("itemSelected", withEdgeEventType: .interact)
Android Interface
Copied to your clipboardpublic class ContentCard {// Plain-text title for the content cardprivate String title;// Plain-text body representing the content for the content cardprivate String body;// String representing a URI that contains an image to be used for this content cardprivate String imageUrl;// Contains a URL to be opened if the user interacts with the content cardprivate String actionUrl;// Required if actionUrl is provided. Text to be used in title of button or link in content cardprivate String actionTitle;public String getTitle() { return title; }public String getBody() { return body; }@Nullable public String getImageUrl() { return imageUrl; }@Nullable public String getActionUrl() { return actionUrl; }@Nullable public String getActionTitle() { return actionTitle; }...}
Public functions
track
Tracks an interaction with the given ContentCard
.
Syntax
Copied to your clipboardpublic void track(final String interaction, final MessagingEdgeEventType eventType);
Parameters
- interaction - a custom
String
value to be recorded in the interaction - eventType - the
MessagingEdgeEventType
to be used for the ensuing Edge Event
Example
Kotlin
Copied to your clipboard// Get content card schema data from a PropositionItem objectval contentCardData = item?.contentCardSchemaDataval contentCard = contentCardData?.contentCard// tracking a displaycontentCard?.track(null, MessagingEdgeEventType.DISPLAY)// tracking a user interactioncontentCard?.track("itemSelected", MessagingEdgeEventType.INTERACT)
Java
Copied to your clipboard// Get content card schema data from a PropositionItem objectContentCardSchemaData contentCardData = item.getContentCardSchemaData();ContentCard contentCard = contentCardData.getContentCard();// tracking a displaycontentCard.track(null, MessagingEdgeEventType.DISPLAY);// tracking a user interactioncontentCard.track("itemSelected", MessagingEdgeEventType.INTERACT);