Skip to content

콘텐츠 카드

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.

Image only

Image only cards are clickable full-sized images.

Captioned image

Captioned image cards are clickable, full-sized images with accompanying descriptive text.

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.

Card methods

All Card data model objects offer the following analytics methods for logging user events to Braze servers.

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.

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.

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.

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.

For more details, refer to the Context class documentation

Prerequisites

Before you can use Content Cards, you’ll need to integrate the Braze Web SDK into your app. However, no additional setup is required. To build your own UI instead, see Content Card Customization Guide.

Standard feed UI

To use the included Content Cards UI, you’ll need to specify where to show the feed on your website.

In this example, we have a <div id="feed"></div> in which we want to place the Content Cards feed. We’ll use three buttons to hide, show, or toggle (hide or show based on its current state) the feed.

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>

When using the toggleContentCards(parentNode, filterFunction) and showContentCards(parentNode, filterFunction) methods, if no arguments are provided, all Content Cards will be shown in a fixed-position sidebar on the right-hand side of the page. Otherwise, the feed will be placed in the specified parentNode option.

See the SDK reference docs for more information on Content Card toggling.

Card types and properties

The Content Cards data model is available in the Web SDK and offers the following Content Card types: ImageOnly, CaptionedImage, and ClassicCard. Each type inherits common properties from a base model Card and has the following additional properties.

Base card model

All Content Cards have these shared properties:

Image only

ImageOnly cards are clickable full-sized images.

Captioned image

CaptionedImage cards are clickable, full-sized images with accompanying descriptive text.

Classic

The ClassicCard model can contain an image with no text or a text with image.

Control group

If you use the default Content Cards feed, impressions and clicks will be automatically tracked.

If you use a custom integration for Content Cards, you need need log impressions when a Control Card would have been seen. As part of this effort, make sure to handle Control cards when logging impressions in an A/B test. These cards are blank, and while they aren’t seen by users, you should still log impressions in order to compare how they perform against non-Control cards.

To determine if a Content Card is in the Control group for an A/B test, check the card.isControl property (Web SDK v4.5.0+) or check if the card is a ControlCard instance (card instanceof braze.ControlCard).

Card methods

For more details, refer to the SDK reference documentation

Using Google Tag Manager

Google Tag Manager works by injecting the Braze CDN (a version of our Web SDK) directly into your website code, which means that all SDK methods are available just as if you had integrated the SDK without Google Tag Manager, except when implementing Content Cards.

Setting up Content Cards

For a standard integration of the Content Card feed, you can use a Custom HTML tag in Google Tag Manager. Add the following to your Custom HTML tag, which will activate the standard Content Card feed:

1
2
3
<script>
   window.braze.showContentCards();
</script>

Tag Configuration in Google Tag Manager of a Custom HTML tag that shows the Content Card feed.

For more freedom over customizing the appearance of Content Cards and their feed, you can directly integrate Content Cards into your native website. There are two approaches you can take with this: using the standard feed UI or creating a custom feed UI.

When implementing the standard feed UI, Braze methods must have window. added to the start of the method. For example, braze.showContentCards should instead be window.braze.showContentCards.

For custom feed styling, the steps are the same as if you had integrated the SDK without GTM. For example, if you want to customize the width of the Content Card feed, you can paste the following into your CSS file:

1
2
3
body .ab-feed { 
    width: 800px;
}

Upgrading templates

To upgrade to the latest version of the Braze Web SDK, take the following three steps in your Google Tag Manager dashboard:

  1. Update tag template
    Go to the Templates page within your workspace. Here you should see an icon indicating an update is available.

    Templates page showing an update is available

    Click that icon and after reviewing the change, click to Accept Update.

    A screen comparing the old and new tag templates with a button to "Accept Update"

  2. Update version number
    Once your tag template has been updated, edit the Braze Initialization Tag, and update the SDK version to the most recent major.minor version. For example, if the latest version is 4.1.2, enter 4.1. You can view a list of SDK versions in our changelog.

    Braze Initialization Template with an input field to change the SDK Version

  3. QA and publish
    Verify the new SDK version is working using Google Tag Manager’s debugging tool prior to publishing an update to your tag container.

Troubleshooting

Enable tag debugging

Each Braze tag template has an optional GTM Tag Debugging checkbox which can be used to log debug messages to your web page’s JavaScript console.

Google Tag Manager's Debug tool

Enter debug mode

Another way to help debug your Google Tag Manager integration is using Google’s Preview mode feature.

This will help identify what values are being sent from your web page’s data layer to each triggered Braze tag and will also explain which tags were or were not triggered.

The Braze Initialization Tag summary page provides an overview of the tag, including information on which tags were triggered.

Enable verbose logging

To allow Braze technical support to access logs while testing, you can enable verbose logging on your Google Tag Manager integration. These logs will appear in the Console tab of your browser’s developer tools.

In your Google Tag Manager integration, navigate to your Braze Initialization Tag and select Enable Web SDK Logging.

The Braze Initialization Tag summary page with the option to Enable Web SDK Logging turned on.

Prerequisites

Before you can use this feature, you’ll need to integrate the Cordova Braze SDK.

카드 피드

Braze SDK에는 기본 카드 피드가 포함되어 있습니다. 기본 카드 피드를 표시하려면 launchContentCards() 방법을 사용할 수 있습니다. 이 메서드는 사용자의 콘텐츠 카드에 대한 모든 분석 추적, 해제 및 렌더링을 처리합니다.

콘텐츠 카드

이러한 추가 메서드를 사용하여 앱 내에서 커스텀 콘텐츠 카드 피드를 빌드할 수 있습니다.

플러터 콘텐츠 카드에 대하여

Braze SDK에는 콘텐츠 카드를 시작할 수 있는 기본 카드 피드가 포함되어 있습니다. 카드 피드를 표시하려면 braze.launchContentCards() 메서드를 사용할 수 있습니다. 기본 카드 피드는 Braze SDK에 포함되어 있으며 모든 분석 추적, 해제 및 사용자의 콘텐츠 카드 렌더링을 처리합니다.

Prerequisites

이 기능을 사용하려면 먼저 Flutter Braze SDK를 통합해야 합니다.

카드 방법

플러그인 공개 인터페이스에서 사용할 수 있는 다음 방법을 사용하여 앱 내에서 사용자 지정 콘텐츠 카드 피드를 구축할 수 있습니다:

콘텐츠 카드 데이터 수신

Flutter 앱에서 콘텐츠 카드 데이터를 수신하려면 BrazePluginDart 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 계층에서 자동으로 전달됩니다.

  1. 콘텐츠 카드 업데이트에 가입하려면 contentCards.subscribeToUpdates를 구현합니다. 자세한 내용은 subscribeToUpdates 설명서를 참조하세요.

  2. 귀하의 contentCards.subscribeToUpdates 콜백 구현은 BrazePlugin.processContentCards(contentCards)를 호출해야 합니다.

예제는 샘플 앱의 AppDelegate.swift 를 참조하세요.

콘텐츠 카드에 대한 콜백 재생

콜백을 사용하기 위해 먼저 트리거된 콘텐츠 카드를 저장하고 설정된 후에 재생하려면 BrazePlugin을 초기화할 때 customConfigs 맵에 다음 항목을 추가합니다.

1
BrazePlugin braze = new BrazePlugin(customConfigs: {replayCallbacksConfigKey: true});

About React Native Content Cards

The Braze SDKs include a default card feed to get you started with Content Cards. To show the card feed, you can use the Braze.launchContentCards() method. The default card feed included with the Braze SDK will handle all analytics tracking, dismissals, and rendering for a user’s Content Cards.

Prerequisites

Before you can use this feature, you’ll need to integrate the React Native Braze SDK.

Cards methods

To build your own UI, you can get a list of available cards, and listen for updates to cards:

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();

You can use these additional methods to build a custom Content Cards Feed within your app:

Card types and properties

The Content Cards data model is available in the React Native SDK and offers the following Content Cards card types: Image Only, Captioned Image, and Classic. There’s also a special Control card type, which is returned to users that are in the control group for a given card. Each type inherits common properties from a base model in addition to its own unique properties.

Base card model

The base card model provides foundational behavior for all cards.

For a full reference of the base card, see the Android and iOS documentation.

Image only

Image only cards are clickable, full-sized images.

For a full reference of the image only card, see the Android and iOS documentation.

Captioned image

Captioned image cards are clickable, full-sized images with accompanying descriptive text.

For a full reference of the captioned image card, see the Android and iOS documentation.

Classic

Classic cards have a title, description, and an optional image on the left of the text.

For a full reference of the classic (text announcement) Content Card, see the Android and iOS documentation. For the classic image (short news) card, see the Android and iOS documentation.

Control

Control cards include all of the base properties, with a few important differences. Most importantly:

  • The isControl property is guaranteed to be true.
  • The extras property is guaranteed to be empty.

For a full reference of the control card, see the Android and iOS documentation.

Prerequisites

콘텐츠 카드를 사용하려면 먼저 Braze Swift SDK를 앱에 통합해야 합니다. 그런 다음 tvOS 앱 설정 단계를 완료해야 합니다.

tvOS 앱 설정하기

1단계: 새 iOS 앱 만들기

Braze에서 설정 > 앱 설정을 선택한 다음, 앱 추가를 선택합니다. tvOS 앱 이름을 입력하고 tvOS가 아닌 iOS를 선택한 다음, 앱 추가를 선택합니다.

ALT_TEXT.

2단계: 앱의 API 키 가져오기

앱 설정에서 새 tvOS 앱을 선택한 다음, 앱의 API 키를 기록합니다. 이 키를 사용하여 Xcode에서 앱을 구성할 수 있습니다.

ALT_TEXT

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에는 기본 모델을 공유하는 세 가지 고유한 콘텐츠 카드 유형이 있습니다: 배너, 캡션 이미지클래식. 각 유형은 기본 모델에서 공통 속성을 상속하며 다음과 같은 추가 속성이 있습니다.

기본 카드 모델

기본 카드에 대한 전체 참조는 AndroidiOS 설명서를 참조하세요.

배너

배너 카드는 클릭 가능한 전체 크기 이미지입니다.

배너 카드에 대한 전체 참조는 AndroidiOS 문서(현재 이미지 전용으로 이름이 변경됨)를 참조하세요.

캡션 이미지

캡션이 있는 이미지 카드는 클릭 가능한 전체 크기 이미지로, 설명 텍스트가 함께 제공됩니다.

캡션이 있는 이미지 카드에 대한 전체 참조는 AndroidiOS 설명서를 참조하세요.

클래식

클래식 카드에는 텍스트 왼쪽에 제목, 설명, 이미지(선택 사항)가 있습니다.

클래식(텍스트 알림) 콘텐츠 카드에 대한 전체 참조는 AndroidiOS 설명서를 참조하세요. 클래식 이미지(짧은 뉴스) 카드에 대한 전체 참조는 AndroidiOS 문서를 참조하세요.

카드 방법

이러한 추가 메서드를 사용하여 앱 내에서 커스텀 콘텐츠 카드 피드를 빌드할 수 있습니다.

방법 설명
requestContentCardsRefresh() Braze SDK 서버에서 최신 콘텐츠 카드를 요청합니다.
getContentCards() Braze SDK에서 콘텐츠 카드를 검색합니다. 그러면 서버에서 최신 카드 목록이 반환됩니다.
logContentCardClicked(cardId) 지정된 콘텐츠 카드 ID에 대한 클릭을 기록합니다. 이 방법은 분석에만 사용됩니다.
logContentCardImpression(cardId) 지정된 콘텐츠 카드 ID에 대한 노출을 기록합니다.
logContentCardDismissed(cardId) 지정된 콘텐츠 카드 ID에 대한 해제를 기록합니다.
이 페이지가 얼마나 도움이 되었나요?
New Stuff!