콘텐츠 카드
Braze SDK의 콘텐츠 카드에 대해 배우고, 애플리케이션에 사용할 수 있는 다양한 데이터 모델과 카드별 속성을 포함합니다.
Prerequisites
Before you can use Braze Content Cards, you’ll need to integrate the Braze Android SDK into your app. However, no additional setup is required.
Google fragments
In Android, the Content Cards feed is implemented as a fragment available in the Braze Android UI project. The ContentCardsFragment class will automatically refresh and display the contents of the Content Cards and log usage analytics. The cards that can appear in a user’s ContentCards are created on the Braze dashboard.
To learn how to add a fragment to an activity, see Google’s fragments documentation.
Card types and properties
The Content Cards data model is available in the Android SDK and offers the following unique Content Card types. Each type shares a base model, which allows them to inherit common properties from the base model, in addition to having their own unique properties. For full reference documentation, see com.braze.models.cards.
Base card model
The base card model provides foundational behavior for all cards.
| Property | Description |
|---|---|
getId() |
Returns the card’s ID set by Braze. |
getViewed() |
Returns a boolean reflects if the card is read or unread by the user. |
getExtras() |
Returns a map of key-value extras for this card. |
getCreated() |
Returns the unix timestamp of the card’s creation time from Braze. |
isPinned |
Returns a boolean that reflects whether the card is pinned. |
getOpenUriInWebView() |
Returns a boolean that reflects whether Uris for this card should be opened in the Braze WebView or not. |
getExpiredAt() |
Gets the expiration date of the card. |
isRemoved() |
Returns a boolean that reflects whether the end user has dismissed this card. |
isDismissibleByUser() |
Returns a boolean that reflects whether the card is dismissible by the user. |
isClicked() |
Returns a boolean that reflects the clicked state of this card. |
isDismissed() |
Returns a boolean if this card has been dismissed. |
isControl() |
Returns a boolean if this card is a control card and should not be rendered. |
Image only
Image only cards are clickable full-sized images.
| Property | Description |
|---|---|
getImageUrl() |
Returns the URL of the card’s image. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns link text for the property URL. |
Captioned image
Captioned image cards are clickable, full-sized images with accompanying descriptive text.
| Property | Description |
|---|---|
getImageUrl() |
Returns the URL of the card’s image. |
getTitle() |
Returns the title text for the card. |
getDescription() |
Returns the body text for the card. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns the link text for the property URL. |
Classic
A classic card without an image included will result in a text announcement card. If an image is included, you will receive a short news card.
| Property | Description |
|---|---|
getTitle() |
Returns the title text for the card. |
getDescription() |
Returns the body text for the card. |
getUrl() |
Returns the URL that will be opened after the card is clicked. It can be a HTTP(s) URL or a protocol URL. |
getDomain() |
Returns the link text for the property URL. |
getImageUrl() |
Returns the URL of the card’s image, applies only to the classic Short News Card. |
Card methods
All Card data model objects offer the following analytics methods for logging user events to Braze servers.
| Method | Description |
|---|---|
logImpression() |
Manually log an impression to Braze for a particular card. |
logClick() |
Manually log a click to Braze for a particular card. |
setIsDismissed() |
Manually log a dismissal to Braze for a particular card. If a card is already marked as dismissed, it cannot be marked as dismissed again. |
Prerequisites
Before you can use Content Cards, you’ll need to integrate the Braze Swift SDK into your app. However, no additional setup is required.
View controller contexts
The default Content Cards UI can be integrated from the BrazeUI library of the Braze SDK. Create the Content Cards view controller using the braze instance. If you wish to intercept and react to the Content Card UI lifecycle, implement BrazeContentCardUIViewControllerDelegate as the delegate for your BrazeContentCardUI.ViewController.
For more information about iOS view controller options, refer to the Apple developer documentation.
The BrazeUI library of the Swift SDK provides two default view controller contexts: navigation or modal. This means you can integrate Content Cards in these contexts by adding a few lines of code to your app or site. Both views offer customization and styling options as described in the customization guide. You can also create a custom Content Card view controller instead of using the standard Braze one for even more customization options—refer to the Content Cards UI tutorial for an example.
To handle control variant Content Cards in your custom UI, pass in your Braze.ContentCard.Control object, then call the logImpression method as you would with any other Content Card type. The object will implicitly log a control impression to inform our analytics of when a user would have seen the control card.
Navigation
A navigation controller is a view controller that manages one or more child view controllers in a navigation interface. Here is an example of pushing a BrazeContentCardUI.ViewController instance into a navigation controller:
1
2
3
4
5
6
7
func pushViewController() {
guard let braze = AppDelegate.braze else { return }
let contentCardsController = BrazeContentCardUI.ViewController(braze: braze)
// Implement and set `BrazeContentCardUIViewControllerDelegate` if you wish to intercept click actions.
contentCardsController.delegate = self
self.navigationController?.pushViewController(contentCardsController, animated: true)
}
1
2
3
4
5
6
- (void)pushViewController {
BRZContentCardUIViewController *contentCardsController = [[BRZContentCardUIViewController alloc] initWithBraze:self.braze];
// Implement and set `BrazeContentCardUIViewControllerDelegate` if you wish to intercept click actions.
[contentCardsController setDelegate:self];
[self.navigationController pushViewController:contentCardsController animated:YES];
}
Modal
Use modal presentations to create temporary interruptions in your app’s workflow, such as prompting the user for important information. This model view has a navigation bar on top and a Done button on the side of the bar. Here is an example of pushing a BrazeContentCard.ViewController instance into a modal controller:
1
2
3
4
5
6
7
func presentModalViewController() {
guard let braze = AppDelegate.braze else { return }
let contentCardsModal = BrazeContentCardUI.ModalViewController(braze: braze)
// Implement and set `BrazeContentCardUIViewControllerDelegate` if you wish to intercept click actions.
contentCardsModal.viewController.delegate = self
self.navigationController?.present(contentCardsModal, animated: true, completion: nil)
}
1
2
3
4
5
6
- (void)presentModalViewController {
BRZContentCardUIModalViewController *contentCardsModal = [[BRZContentCardUIModalViewController alloc] initWithBraze:AppDelegate.braze];
// Implement and set `BrazeContentCardUIViewControllerDelegate` if you wish to intercept click actions.
[contentCardsModal.viewController setDelegate:self];
[self.navigationController presentViewController:contentCardsModal animated:YES completion:nil];
}
For example usage of BrazeUI view controllers, check out the corresponding Content Cards UI samples in our Examples app.
Base card model
The Content Cards data model is available in the BrazeKit module of the Braze Swift SDK. This module contains the following Content Card types, which are an implementation of the Braze.ContentCard type. For a full list of Content Card properties and their usage, see ContentCard class.
- Image only
- Captioned image
- Classic
- Classic image
- Control
To access the Content Cards data model, call contentCards.cards on your braze instance. See Logging analytics for more information on subscribing to card data.
Keep in mind, BrazeKit offers an alternative ContentCardRaw class for Objective-C compatibility.
Card methods
Each card is initialized with a Context object, which contains various methods for managing your card’s state. Call these methods when you want to modify the corresponding state property on a particular card object.
| Method | Description |
|---|---|
card.context?.logImpression() |
Log the content card impression event. |
card.context?.logClick() |
Log the content card click event. |
card.context?.processClickAction() |
Process a given ClickAction input. |
card.context?.logDismissed() |
Log the content card dismissed event. |
card.context?.logError() |
Log an error related to the content card. |
card.context?.loadImage() |
Load a given content card image from a URL. This method can be nil when the content card does not have an image. |
For more details, refer to the Context class documentation
이 가이드는 Braze Web SDK 4.0.0+의 코드 샘플을 사용합니다. 최신 웹 SDK 버전으로 업그레이드하려면 SDK 업그레이드 가이드를 참조하세요.
필수 조건
콘텐츠 카드를 사용하려면 먼저 Braze 웹 SDK를 앱에 통합해야 합니다. 그러나 추가 설정은 필요하지 않습니다. 대신 고유한 UI를 구축하려면 콘텐츠 카드 커스텀 가이드를 참조하세요.
표준 피드 UI
포함된 콘텐츠 카드 UI를 사용하려면 웹사이트에서 피드를 표시할 위치를 지정해야 합니다.
이 예제에서는 콘텐츠 카드 피드를 <div id="feed"></div>에 배치하려고 합니다. 세 개의 버튼을 사용하여 피드를 숨기거나, 표시하거나, 토글(현재 상태에 따라 숨기거나 표시)합니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<button id="toggle" type="button">Toggle Cards Feed</button>
<button id="hide" type="button">Hide Cards Feed</button>
<button id="show" type="button">Show Cards Feed</button>
<nav>
<h1>Your Personalized Feed</h1>
<div id="feed"></div>
</nav>
<script>
const toggle = document.getElementById("toggle");
const hide = document.getElementById("hide");
const show = document.getElementById("show");
const feed = document.getElementById("feed");
toggle.onclick = function(){
braze.toggleContentCards(feed);
}
hide.onclick = function(){
braze.hideContentCards();
}
show.onclick = function(){
braze.showContentCards(feed);
}
</script>
toggleContentCards(parentNode, filterFunction) 및 showContentCards(parentNode, filterFunction) 메서드를 사용하는 경우 인수를 제공하지 않으면 모든 콘텐츠 카드가 페이지 오른쪽에 있는 고정 위치 사이드바에 표시됩니다. 그렇지 않으면 피드가 지정된 parentNode 옵션에 배치됩니다.
| 매개변수 | Description |
|---|---|
parentNode |
콘텐츠 카드를 렌더링할 HTML 노드입니다. 상위 노드에 이미 Braze 콘텐츠 카드 보기가 직계 하위로 존재하는 경우 기존 콘텐츠 카드가 대체됩니다. 예를 들어 document.querySelector(".my-container")를 전달해야 합니다. |
filterFunction |
이 보기에 표시되는 카드의 필터 또는 정렬 기능입니다. {pinned, date} 기준으로 정렬된 Card 오브젝트 배열로 호출됩니다. 이 사용자에 대해 렌더링할 정렬된 Card 오브젝트 배열을 반환할 것으로 예상됩니다. 생략하면 모든 카드가 표시됩니다. |
콘텐츠 카드 토글에 대한 자세한 내용은 SDK 참조 설명서를 참조하세요.
카드 유형 및 속성
콘텐츠 카드 데이터 모델은 웹 소프트웨어 개발 키트에서 사용할 수 있으며 다음과 같은 콘텐츠 카드 유형을 제공합니다: ImageOnly, CaptionedImage, ClassicCard. 각 유형은 기본 모델 카드에서 공통 속성정보를 상속받으며 다음과 같은 추가 속성정보가 있습니다.
콘텐츠 카드 데이터를 로깅하려면 분석 로깅을 참조하세요.
기본 카드 모델
모든 콘텐츠 카드에는 이러한 공유 속성이 있습니다:
| 등록정보 | 설명 |
|---|---|
expiresAt |
카드 만료 시간의 Unix 타임스탬프. |
extras |
(선택 사항) 값 문자열이 포함된 문자열 오브젝트로 형식이 지정된 키-값 페어 데이터. |
id |
(선택 사항) 카드의 ID입니다. 이는 분석 목적으로 이벤트와 함께 Braze에 다시 보고됩니다. |
pinned |
이 속성정보는 대시보드에서 카드가 ‘고정됨’으로 설정되었는지 여부를 반영합니다. |
updated |
이 카드가 마지막으로 수정된 시점의 UNIX 타임스탬프입니다. |
viewed |
이 속성정보는 사용자가 카드를 조회했는지 여부를 반영합니다. |
isControl |
이 속성정보는 카드가 A/B 테스트 내에서 ‘대조군’인 경우 true입니다. |
이미지만
ImageOnly 카드는 클릭 가능한 전체 크기 이미지입니다.
| 등록정보 | 설명 |
|---|---|
aspectRatio |
카드 이미지의 가로 세로 비율이며 이미지 로딩이 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성이 제공되지 않을 수 있습니다. |
categories |
이 속성정보는 순전히 커스텀 구현의 구성을 위해 제공되며, 대시보드 작성기에서 이러한 카테고리를 설정할 수 있습니다. |
clicked |
이 속성정보는 이 카드가 이 기기에서 클릭된 적이 있는지 여부를 나타냅니다. |
created |
Braze에서 카드가 생성된 시간의 UNIX 타임스탬프입니다. |
dismissed |
이 속성은 이 카드가 기각되었는지 여부를 나타냅니다. |
dismissible |
이 속성은 사용자가 카드를 해지하여 보기에서 제거할 수 있는지 여부를 반영합니다. |
imageUrl |
카드 이미지의 URL입니다. |
linkText |
URL의 표시 텍스트입니다. |
url |
카드를 클릭한 후 열릴 URL입니다. |
캡션 이미지
CaptionedImage 카드는 클릭 가능한 전체 크기 이미지로, 설명 텍스트가 함께 제공됩니다.
| 등록정보 | 설명 |
|---|---|
aspectRatio |
카드 이미지의 가로 세로 비율이며 이미지 로딩이 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성이 제공되지 않을 수 있습니다. |
categories |
이 속성정보는 순전히 커스텀 구현의 구성을 위해 제공되며, 대시보드 작성기에서 이러한 카테고리를 설정할 수 있습니다. |
clicked |
이 속성정보는 이 카드가 이 기기에서 클릭된 적이 있는지 여부를 나타냅니다. |
created |
Braze에서 카드가 생성된 시간의 UNIX 타임스탬프입니다. |
dismissed |
이 속성은 이 카드가 기각되었는지 여부를 나타냅니다. |
dismissible |
이 속성은 사용자가 카드를 해지하여 보기에서 제거할 수 있는지 여부를 반영합니다. |
imageUrl |
카드 이미지의 URL입니다. |
linkText |
URL의 표시 텍스트입니다. |
title |
이 카드의 제목 텍스트입니다. |
url |
카드를 클릭한 후 열릴 URL입니다. |
클래식
클래식카드 모델에는 텍스트가 없는 이미지 또는 텍스트가 있는 이미지가 포함될 수 있습니다.
| 등록정보 | 설명 |
|---|---|
aspectRatio |
카드 이미지의 가로 세로 비율이며 이미지 로딩이 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성이 제공되지 않을 수 있습니다. |
categories |
이 속성정보는 순전히 커스텀 구현의 구성을 위해 제공되며, 대시보드 작성기에서 이러한 카테고리를 설정할 수 있습니다. |
clicked |
이 속성정보는 이 카드가 이 기기에서 클릭된 적이 있는지 여부를 나타냅니다. |
created |
Braze에서 카드가 생성된 시간의 UNIX 타임스탬프입니다. |
description |
이 카드의 본문 텍스트입니다. |
dismissed |
이 속성은 이 카드가 기각되었는지 여부를 나타냅니다. |
dismissible |
이 속성은 사용자가 카드를 해지하여 보기에서 제거할 수 있는지 여부를 반영합니다. |
imageUrl |
카드 이미지의 URL입니다. |
linkText |
URL의 표시 텍스트입니다. |
title |
이 카드의 제목 텍스트입니다. |
url |
카드를 클릭한 후 열릴 URL입니다. |
대조군
기본 콘텐츠 카드 피드를 사용하는 경우 노출 수와 클릭 수가 자동으로 추적됩니다.
콘텐츠 카드에 대한 커스텀 통합을 사용하는 경우 제어 카드가 표시되면 노출 횟수를 기록해야 합니다. 이러한 노력의 일환으로, A/B 테스트에서 노출 횟수를 기록할 때 제어 카드를 처리해야 합니다. 이러한 카드는 비어 있으며 사용자에게 표시되지 않지만, 여전히 노출 횟수를 기록하여 제어 카드가 아닌 카드와 해당 성능을 비교해야 합니다.
콘텐츠 카드가 A/B 테스트의 대조군에 있는지 확인하려면 card.isControl 속성정보(Web SDK v4.5.0 이상)를 확인하거나 카드가 ControlCard 인스턴스(card instanceof braze.ControlCard)인지 확인합니다.
카드 방법
| 방법 | 설명 |
|---|---|
logContentCardImpressions |
지정된 카드 목록에 대한 노출 이벤트를 기록합니다. Braze UI가 아닌 사용자 지정 UI를 사용할 때 필요합니다. |
logContentCardClick |
지정된 카드에 대한 클릭 이벤트를 기록합니다. Braze UI가 아닌 사용자 지정 UI를 사용할 때 필요합니다. |
showContentCards |
사용자의 콘텐츠 카드를 표시합니다. |
hideContentCards |
현재 표시된 Braze 콘텐츠 카드를 숨깁니다. |
toggleContentCards |
사용자의 콘텐츠 카드를 표시합니다. |
getCachedContentCards |
마지막 콘텐츠 카드 새로 고침에서 현재 사용 가능한 모든 카드를 가져옵니다. |
subscribeToContentCardsUpdates |
콘텐츠 카드 업데이트에 가입합니다. 구독자 콜백은 콘텐츠 카드가 업데이트될 때마다 호출됩니다. |
dismissCard |
프로그래밍 방식으로 카드를 해제합니다(v2.4.1에서 사용 가능). |
자세한 내용은 SDK 참조 설명서를 참조하세요.
Google 태그 관리자 사용
Google 태그 매니저는 웹사이트 코드에 Braze CDN (웹 SDK 버전)을 직접 삽입하는 방식으로 작동하므로 콘텐츠 카드를 구현할 때를 제외하고는 Google 태그 매니저 없이 SDK를 통합한 것처럼 모든 SDK 방법을 사용할 수 있습니다.
콘텐츠 카드 설정하기
콘텐츠 카드 피드의 표준 통합을 위해 Google 태그 관리자에서 사용자 정의 HTML 태그를 사용할 수 있습니다. 표준 콘텐츠 카드 피드를 활성화하는 사용자 정의 HTML 태그에 다음을 추가합니다:
1
2
3
<script>
window.braze.showContentCards();
</script>

콘텐츠 카드의 모양과 피드를 보다 자유롭게 사용자 지정하려는 경우 콘텐츠 카드를 기본 웹사이트에 직접 통합할 수 있습니다. 표준 피드 UI를 사용하거나 커스텀 피드 UI를 생성하는 두 가지 접근 방식이 있습니다.
템플릿 업그레이드
Braze 웹 SDK의 최신 버전으로 업그레이드하려면Google Tag Manager 대시보드에서 다음 세 단계를 수행합니다.
- 태그 템플릿 업데이트
워크스페이스 내의 템플릿 페이지로 이동합니다. 여기에 업데이트를 사용할 수 있음을 나타내는 아이콘이 표시됩니다.
해당 아이콘을 클릭하고 변경 사항을 검토한 후 업데이트 수락을 클릭합니다.
- 업데이트 버전 번호
태그 템플릿이 업데이트되면 Braze 초기화 태그를 편집하고 SDK 버전을 최신major.minor버전으로 업데이트합니다. 예를 들어 최신 버전이4.1.2인 경우4.1을 입력합니다. SDK 버전 목록은 변경 로그에서 확인할 수 있습니다.
- QA 및 게시
태그 컨테이너에 업데이트를 게시하기 전에 Google 태그 관리자의 디버깅 도구를 사용하여 새 SDK 버전이 작동하는지 확인합니다.
문제 해결
태그 디버깅 사용
각 Braze 태그 템플릿에는 웹 페이지의 JavaScript 콘솔에 디버그 메시지를 기록하는 데 사용할 수 있는 GTM 태그 디버깅 체크박스(선택 사항)가 있습니다.

디버그 모드로 전환
Google 태그 관리자 연동 디버깅에 도움이 되는 또 다른 방법은 Google의 미리보기 모드 기능을 사용하는 것입니다.
이렇게 하면 웹 페이지의 데이터 레이어에서 트리거된 각 Braze 태그로 전송되는 값을 식별하는 데 도움이 되며, 어떤 태그가 트리거되었는지 또는 트리거되지 않았는지도 설명할 수 있습니다.

상세 로깅 활성화
테스트하는 동안 Braze 기술 지원팀이 로그에 액세스할 수 있도록 하려면 Google Tag Manager 통합에서 상세 로깅을 활성화하면 됩니다. 이러한 로그는 브라우저 개발자 도구의 콘솔 탭에 표시됩니다.
Google Tag Manager 통합에서 Braze 초기화 태그로 이동하고 웹 SDK 로깅 활성화를 선택합니다.

Prerequisites
Before you can use this feature, you’ll need to integrate the Cordova Braze SDK.
카드 피드
Braze SDK에는 기본 카드 피드가 포함되어 있습니다. 기본 카드 피드를 표시하려면 launchContentCards() 방법을 사용할 수 있습니다. 이 메서드는 사용자의 콘텐츠 카드에 대한 모든 분석 추적, 해제 및 렌더링을 처리합니다.
콘텐츠 카드
이러한 추가 메서드를 사용하여 앱 내에서 커스텀 콘텐츠 카드 피드를 빌드할 수 있습니다.
| 방법 | 설명 |
|---|---|
requestContentCardsRefresh() |
Braze SDK 서버에서 최신 콘텐츠 카드를 요청하는 백그라운드 요청을 보냅니다. |
getContentCardsFromServer(successCallback, errorCallback) |
Braze SDK에서 콘텐츠 카드를 검색합니다. 이렇게 하면 서버에서 최신 콘텐츠 카드를 요청하고 완료되면 카드 목록을 반환합니다. |
getContentCardsFromCache(successCallback, errorCallback) |
Braze SDK에서 콘텐츠 카드를 검색합니다. 이렇게 하면 마지막 새로 고침 시 업데이트된 로컬 캐시에서 최신 카드 목록이 반환됩니다. |
logContentCardClicked(cardId) |
지정된 콘텐츠 카드 ID에 대한 클릭을 기록합니다. |
logContentCardImpression(cardId) |
지정된 콘텐츠 카드 ID에 대한 노출을 기록합니다. |
logContentCardDismissed(cardId) |
지정된 콘텐츠 카드 ID에 대한 해제를 기록합니다. |
플러터 콘텐츠 카드에 대하여
Braze SDK에는 콘텐츠 카드를 시작할 수 있는 기본 카드 피드가 포함되어 있습니다. 카드 피드를 표시하려면 braze.launchContentCards() 메서드를 사용할 수 있습니다. 기본 카드 피드는 Braze SDK에 포함되어 있으며 모든 분석 추적, 해제 및 사용자의 콘텐츠 카드 렌더링을 처리합니다.
Prerequisites
이 기능을 사용하려면 먼저 Flutter Braze SDK를 통합해야 합니다.
카드 방법
플러그인 공개 인터페이스에서 사용할 수 있는 다음 방법을 사용하여 앱 내에서 사용자 지정 콘텐츠 카드 피드를 구축할 수 있습니다:
| 방법 | 설명 |
|---|---|
braze.requestContentCardsRefresh() |
Braze SDK 서버에서 최신 콘텐츠 카드를 요청합니다. |
braze.logContentCardClicked(contentCard) |
주어진 콘텐츠 카드 객체에 대해 클릭을 기록합니다. |
braze.logContentCardImpression(contentCard) |
지정된 콘텐츠 카드 객체에 대해 노출 횟수를 기록합니다. |
braze.logContentCardDismissed(contentCard) |
주어진 콘텐츠 카드 객체에 대한 해제를 기록합니다. |
콘텐츠 카드 데이터 수신
Flutter 앱에서 콘텐츠 카드 데이터를 수신하려면 BrazePlugin이 Dart Streams를 사용하여 콘텐츠 카드 데이터 전송을 지원합니다.
BrazeContentCard 오브젝트는 description, title, image, url, extras 등을 포함하여 기본 모델 오브젝트에서 사용할 수 있는 필드의 하위 집합을 지원합니다.
1단계: Dart 레이어에서 콘텐츠 카드 데이터 수신
Dart 레이어에서 콘텐츠 카드 데이터를 수신하려면 아래 코드를 사용하여 StreamSubscription을 생성하고 braze.subscribeToContentCards()를 호출합니다. 스트림 가입이 더 이상 필요하지 않은 경우 cancel()을 수행합니다.
1
2
3
4
5
6
7
8
9
// Create stream subscription
StreamSubscription contentCardsStreamSubscription;
contentCardsStreamSubscription = braze.subscribeToContentCards((List<BrazeContentCard> contentCards) {
// Handle Content Cards
}
// Cancel stream subscription
contentCardsStreamSubscription.cancel();
예제는 샘플 앱의 main.dart 를 참조하세요.
2단계: 네이티브 레이어에서 콘텐츠 카드 데이터를 전달
1단계의 Dart 레이어에서 데이터를 수신하려면 다음 코드를 추가하여 기본 레이어에서 콘텐츠 카드 데이터를 전달합니다.
콘텐츠 카드 데이터는 Android 계층에서 자동으로 전달됩니다.
-
콘텐츠 카드 업데이트에 가입하려면
contentCards.subscribeToUpdates를 구현합니다. 자세한 내용은 subscribeToUpdates 설명서를 참조하세요. -
귀하의
contentCards.subscribeToUpdates콜백 구현은BrazePlugin.processContentCards(contentCards)를 호출해야 합니다.
예제는 샘플 앱의 AppDelegate.swift 를 참조하세요.
콘텐츠 카드에 대한 콜백 재생
콜백을 사용하기 위해 먼저 트리거된 콘텐츠 카드를 저장하고 설정된 후에 재생하려면 BrazePlugin을 초기화할 때 customConfigs 맵에 다음 항목을 추가합니다.
1
BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: true});
리액트 네이티브 콘텐츠 카드에 대하여
Braze SDK에는 콘텐츠 카드를 시작할 수 있는 기본 카드 피드가 포함되어 있습니다. 카드 피드를 표시하려면 Braze.launchContentCards() 메서드를 사용할 수 있습니다. 기본 카드 피드는 Braze SDK에 포함되어 있으며 모든 분석 추적, 해제 및 사용자의 콘텐츠 카드 렌더링을 처리합니다.
Prerequisites
Before you can use this feature, you’ll need to integrate the React Native Braze SDK.
카드 메서드
자체 UI를 빌드하려면 사용 가능한 카드 목록을 가져오고 카드 업데이트를 수신 대기할 수 있습니다.
1
2
3
4
5
6
7
8
9
10
11
// Set initial cards
const [cards, setCards] = useState([]);
// Listen for updates as a result of card refreshes, such as:
// a new session, a manual refresh with `requestContentCardsRefresh()`, or after the timeout period
Braze.addListener(Braze.Events.CONTENT_CARDS_UPDATED, async (update) => {
setCards(update.cards);
});
// Manually trigger a refresh of cards
Braze.requestContentCardsRefresh();
카드를 표시할 자체 UI를 빌드하려는 경우 해당 카드에 대한 분석을 수신하려면 logContentCardImpression을 호출해야 합니다. 여기에 control 카드가 포함되며, 사용자가 카드를 볼 수 없더라도 추적해야 합니다.
이러한 추가 메서드를 사용하여 앱 내에서 커스텀 콘텐츠 카드 피드를 빌드할 수 있습니다.
| 방법 | 설명 |
|---|---|
launchContentCards() |
콘텐츠 카드 UI 요소를 실행합니다. |
requestContentCardsRefresh() |
Braze SDK 서버에서 최신 콘텐츠 카드를 요청합니다. 결과 카드 목록은 이전에 등록된 각 콘텐츠 카드 이벤트 리스너로 전달됩니다. |
getContentCards() |
Braze SDK에서 콘텐츠 카드를 검색합니다. 이것은 서버에서 최신 카드 목록으로 해결되는 약속을 반환합니다. |
getCachedContentCards() |
캐시에서 가장 최근의 콘텐츠 카드 배열을 반환합니다. |
logContentCardClicked(cardId) |
지정된 콘텐츠 카드 ID에 대한 클릭을 기록합니다. 이 방법은 분석에만 사용됩니다. 클릭 작업을 실행하려면 processContentCardClickAction(cardId)을(를) 추가로 호출하십시오. |
logContentCardImpression(cardId) |
지정된 콘텐츠 카드 ID에 대한 노출을 기록합니다. |
logContentCardDismissed(cardId) |
지정된 콘텐츠 카드 ID에 대한 해제를 기록합니다. |
processContentCardClickAction(cardId) |
특정 카드의 동작을 수행합니다. |
카드 유형 및 속성
콘텐츠 카드 데이터 모델은 리액트 네이티브 SDK에서 사용할 수 있으며 다음과 같은 콘텐츠 카드 유형을 제공합니다: 이미지 전용, 캡션 이미지, 및 클래식. 특별한 대조군 카드 유형도 있으며, 이는 주어진 카드에 대한 대조군에 있는 사용자에게 반환됩니다. 각 유형은 고유한 속성 외에도 기본 모델에서 공통 속성을 상속받습니다.
기본 카드 모델
기본 카드 모델은 모든 카드에 대한 기초적인 동작을 제공합니다.
| 등록정보 | 설명 |
|---|---|
id |
Braze에서 설정한 카드의 ID입니다. |
created |
Braze에서 카드가 생성된 시간의 UNIX 타임스탬프입니다. |
expiresAt |
카드 만료 시간의 UNIX 타임스탬프입니다. 값이 0보다 작으면 카드가 만료되지 않는다는 의미입니다. |
viewed |
사용자가 카드를 읽었는지 또는 읽지 않았는지 여부. 이는 분석을 기록하지 않습니다. |
clicked |
사용자가 카드를 클릭했는지 여부. |
pinned |
카드가 고정되어 있는지 여부. |
dismissed |
사용자가 이 카드를 해지했는지 여부입니다. 이미 기각된 카드를 기각된 것으로 표시하는 것은 불가능합니다. |
dismissible |
사용자가 카드를 해지할 수 있는지 여부입니다. |
url |
(선택 사항) 카드 클릭 작업과 관련된 URL 문자열입니다. |
openURLInWebView |
이 카드의 URL이 Braze WebView에서 열려야 하는지 여부입니다. |
isControl |
이 카드가 제어 카드인지 여부. 제어 카드는 사용자에게 표시되지 않아야 합니다. |
extras |
이 카드의 키 값 추가 항목 맵. |
기본 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요.
이미지만
이미지 전용 카드는 클릭 가능한 전체 크기 이미지입니다.
| 등록정보 | 설명 |
|---|---|
type |
콘텐츠 카드 유형, IMAGE_ONLY. |
image |
카드 이미지의 URL입니다. |
imageAspectRatio |
카드 이미지의 종횡비입니다. 이미지 로드가 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성정보가 제공되지 않을 수 있습니다. |
이미지 전용 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요.
캡션 이미지
캡션이 있는 이미지 카드는 클릭 가능한 전체 크기 이미지로, 설명 텍스트가 함께 제공됩니다.
| 등록정보 | 설명 |
|---|---|
type |
콘텐츠 카드 유형, CAPTIONED. |
image |
카드 이미지의 URL입니다. |
imageAspectRatio |
카드 이미지의 종횡비입니다. 이미지 로드가 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성정보가 제공되지 않을 수 있습니다. |
title |
카드의 제목 텍스트입니다. |
cardDescription |
카드의 설명 텍스트입니다. |
domain |
(선택 사항) 속성 URL의 링크 텍스트(예: "braze.com/resources/"). 카드의 UI에 표시되어 카드를 클릭할 때 동작과 방향을 나타낼 수 있습니다. |
캡션이 있는 이미지 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요.
클래식
클래식 카드에는 텍스트 왼쪽에 제목, 설명, 이미지(선택 사항)가 있습니다.
| 등록정보 | 설명 |
|---|---|
type |
콘텐츠 카드 유형, CLASSIC. |
image |
(선택 사항) 카드 이미지의 URL입니다. |
title |
카드의 제목 텍스트입니다. |
cardDescription |
카드의 설명 텍스트입니다. |
domain |
(선택 사항) 속성 URL의 링크 텍스트(예: "braze.com/resources/"). 카드의 UI에 표시되어 카드를 클릭할 때 동작과 방향을 나타낼 수 있습니다. |
클래식(텍스트 알림) 콘텐츠 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요. 클래식 이미지(짧은 뉴스) 카드에 대해서는 안드로이드 및 iOS 설명서를 참조하십시오.
제어
제어 카드에는 몇 가지 중요한 차이점이 있는 모든 기본 속성이 포함됩니다. 특히 다음 사항이 중요합니다.
isControl속성은true로 보장됩니다.extras속성은 비어 있음을 보장합니다.
Prerequisites
콘텐츠 카드를 사용하려면 먼저 Braze Swift SDK를 앱에 통합해야 합니다. 그런 다음 tvOS 앱 설정 단계를 완료해야 합니다.
콘텐츠 카드는 tvOS용 기본 UI나 보기가 포함되지 않은 Swift SDK를 사용하는 헤드리스 UI를 통해 지원되므로 자체 커스텀 UI를 구현해야 합니다.
tvOS 앱 설정하기
1단계: 새 iOS 앱 만들기
Braze에서 설정 > 앱 설정을 선택한 다음, 앱 추가를 선택합니다. tvOS 앱 이름을 입력하고 tvOS가 아닌 iOS를 선택한 다음, 앱 추가를 선택합니다.

tvOS 확인란을 선택하면 tvOS용 콘텐츠 카드를 사용자 지정할 수 없습니다.
2단계: 앱의 API 키 가져오기
앱 설정에서 새 tvOS 앱을 선택한 다음, 앱의 API 키를 기록합니다. 이 키를 사용하여 Xcode에서 앱을 구성할 수 있습니다.

3단계: BrazeKit 통합
앱의 API 키를 사용하여 Braze Swift SDK를 Xcode의 tvOS 프로젝트에 통합합니다. Braze Swift SDK에서 BrazeKit를 통합하기만 하면 됩니다.
4단계: 사용자 지정 UI 만들기
Braze는 tvOS에서 콘텐츠 카드에 대한 기본 UI를 제공하지 않으므로 직접 사용자 지정해야 합니다. 전체 안내는 단계별 튜토리얼을 참조하세요. tvOS용 콘텐츠 카드 사용자 지정. 샘플 프로젝트는 Braze Swift SDK 샘플을 참조하세요.
Prerequisites
이 기능을 사용하려면 먼저 Unity Braze SDK를 통합해야 합니다.
기본적으로 콘텐츠 카드 표시
다음 호출을 사용하여 콘텐츠 카드의 기본 UI를 표시할 수 있습니다:
1
Appboy.AppboyBinding.DisplayContentCards();
Unity에서 콘텐츠 카드 데이터 수신
수신 콘텐츠 카드에 대한 알림을 받도록 Unity 게임 오브젝트를 등록할 수 있습니다. Braze 설정 에디터에서 게임 오브젝트 리스너를 설정하는 것을 권장합니다.
런타임에 게임 오브젝트 리스너를 구성해야 하는 경우 AppboyBinding.ConfigureListener()를 사용하고 BrazeUnityMessageType.CONTENT_CARDS_UPDATED를 지정합니다.
iOS의 게임 오브젝트 리스너에서 데이터 수신을 시작하려면 추가적으로 AppboyBinding.RequestContentCardsRefresh()를 호출해야 합니다.
콘텐츠 카드 구문 분석
콘텐츠 카드 게임 오브젝트 콜백에서 수신되는 string 메시지는 편의를 위해 미리 제공된 ContentCard 모델 오브젝트로 파싱할 수 있습니다.
콘텐츠 카드 구문 분석에는 JSON 구문 분석이 필요하며, 자세한 내용은 다음 예시를 참조하세요:
콘텐츠 카드 콜백 예시
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void ExampleCallback(string message) {
try {
JSONClass json = (JSONClass)JSON.Parse(message);
// Content Card data is contained in the `mContentCards` field of the top level object.
if (json["mContentCards"] != null) {
JSONArray jsonArray = (JSONArray)JSON.Parse(json["mContentCards"].ToString());
Debug.Log(String.Format("Parsed content cards array with {0} cards", jsonArray.Count));
// Iterate over the card array to parse individual cards.
for (int i = 0; i < jsonArray.Count; i++) {
JSONClass cardJson = jsonArray[i].AsObject;
try {
ContentCard card = new ContentCard(cardJson);
Debug.Log(String.Format("Created card object for card: {0}", card));
// Example of logging Content Card analytics on the ContentCard object
card.LogImpression();
card.LogClick();
} catch {
Debug.Log(String.Format("Unable to create and log analytics for card {0}", cardJson));
}
}
}
} catch {
throw new ArgumentException("Could not parse content card JSON message.");
}
}
콘텐츠 카드 새로 고침
Braze에서 콘텐츠 카드를 새로 고치려면 다음 메서드 중 하나를 호출합니다.
1
2
3
4
// results in a network request to Braze
AppboyBinding.RequestContentCardsRefresh()
AppboyBinding.RequestContentCardsRefreshFromCache()
분석
Braze에서 직접 표시하지 않는 콘텐츠 카드의 경우 클릭 수와 노출 수를 수동으로 기록해야 합니다.
특정 카드의 클릭 및 노출 횟수를 기록하려면 ContentCard에서 LogClick() 및 LogImpression()을 사용합니다.
Xamarin 콘텐츠 카드 정보
브레이즈 자마린 SDK에는 콘텐츠 카드를 시작할 수 있는 기본 카드 피드가 포함되어 있습니다. 기본 카드 피드는 Braze SDK에 포함되어 있으며 모든 분석 추적, 해제 및 사용자의 콘텐츠 카드 렌더링을 처리합니다.
Prerequisites
이 기능을 사용하기 전에 Xamarin Braze 소프트웨어 개발 키트를 통합해야 합니다.
카드 유형 및 속성
브레이즈 자마린 SDK에는 기본 모델을 공유하는 세 가지 고유한 콘텐츠 카드 유형이 있습니다: 배너, 캡션 이미지 및 클래식. 각 유형은 기본 모델에서 공통 속성을 상속하며 다음과 같은 추가 속성이 있습니다.
기본 카드 모델
| 등록정보 | 설명 |
|---|---|
idString |
Braze에서 설정한 카드의 ID입니다. |
created |
Braze에서 카드가 생성된 시간의 UNIX 타임스탬프입니다. |
expiresAt |
카드 만료 시간의 UNIX 타임스탬프입니다. 값이 0보다 작으면 카드가 만료되지 않는다는 의미입니다. |
viewed |
사용자가 카드를 읽었는지 또는 읽지 않았는지 여부. 이는 분석을 기록하지 않습니다. |
clicked |
사용자가 카드를 클릭했는지 여부. |
pinned |
카드가 고정되어 있는지 여부. |
dismissed |
사용자가 이 카드를 해지했는지 여부입니다. 이미 기각된 카드를 기각된 것으로 표시하는 것은 불가능합니다. |
dismissible |
사용자가 카드를 해지할 수 있는지 여부입니다. |
urlString |
(선택 사항) 카드 클릭 동작과 연결된 URL 문자열입니다. |
openUrlInWebView |
이 카드의 URL을 Braze WebView에서 열어야 하는지 여부입니다. |
isControlCard |
이 카드가 제어 카드인지 여부. 제어 카드는 사용자에게 표시되지 않아야 합니다. |
extras |
이 카드의 키 값 추가 항목 맵. |
isTest |
이 카드가 테스트 카드인지 여부. |
기본 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요.
배너
배너 카드는 클릭 가능한 전체 크기 이미지입니다.
| 등록정보 | 설명 |
|---|---|
image |
카드 이미지의 URL입니다. |
imageAspectRatio |
카드 이미지의 종횡비입니다. 이미지 로드가 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성정보가 제공되지 않을 수 있습니다. |
배너 카드에 대한 전체 참조는 Android 및 iOS 문서(현재 이미지 전용으로 이름이 변경됨)를 참조하세요.
캡션 이미지
캡션이 있는 이미지 카드는 클릭 가능한 전체 크기 이미지로, 설명 텍스트가 함께 제공됩니다.
| 등록정보 | 설명 |
|---|---|
image |
카드 이미지의 URL입니다. |
imageAspectRatio |
카드 이미지의 종횡비입니다. 이미지 로드가 완료되기 전에 힌트 역할을 합니다. 특정 상황에서는 속성정보가 제공되지 않을 수 있습니다. |
title |
카드의 제목 텍스트입니다. |
cardDescription |
카드의 설명 텍스트입니다. |
domain |
(선택 사항) 속성 URL의 링크 텍스트(예: "braze.com/resources/"). 카드의 UI에 표시되어 카드를 클릭할 때 동작과 방향을 나타낼 수 있습니다. |
캡션이 있는 이미지 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요.
클래식
클래식 카드에는 텍스트 왼쪽에 제목, 설명, 이미지(선택 사항)가 있습니다.
| 등록정보 | 설명 |
|---|---|
image |
(선택 사항) 카드 이미지의 URL입니다. |
title |
카드의 제목 텍스트입니다. |
cardDescription |
카드의 설명 텍스트입니다. |
domain |
(선택 사항) 속성 URL의 링크 텍스트(예: "braze.com/resources/"). 카드의 UI에 표시되어 카드를 클릭할 때 동작과 방향을 나타낼 수 있습니다. |
클래식(텍스트 알림) 콘텐츠 카드에 대한 전체 참조는 Android 및 iOS 설명서를 참조하세요. 클래식 이미지(짧은 뉴스) 카드에 대한 전체 참조는 Android 및 iOS 문서를 참조하세요.
카드 방법
이러한 추가 메서드를 사용하여 앱 내에서 커스텀 콘텐츠 카드 피드를 빌드할 수 있습니다.
| 방법 | 설명 |
|---|---|
requestContentCardsRefresh() |
Braze SDK 서버에서 최신 콘텐츠 카드를 요청합니다. |
getContentCards() |
Braze SDK에서 콘텐츠 카드를 검색합니다. 그러면 서버에서 최신 카드 목록이 반환됩니다. |
logContentCardClicked(cardId) |
지정된 콘텐츠 카드 ID에 대한 클릭을 기록합니다. 이 방법은 분석에만 사용됩니다. |
logContentCardImpression(cardId) |
지정된 콘텐츠 카드 ID에 대한 노출을 기록합니다. |
logContentCardDismissed(cardId) |
지정된 콘텐츠 카드 ID에 대한 해제를 기록합니다. |
GitHub 에서 이 페이지를 편집합니다.