Skip to content

사용자 속성 설정

Braze SDK를 통해 사용자 속성을 설정하는 방법을 알아보세요.

Prerequisites

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

기본 사용자 속성

사용자에 대한 기본 속성을 설정하려면, Braze 인스턴스에서 getCurrentUser() 메서드를 호출하여 앱의 현재 사용자에 대한 참조를 가져옵니다. 그런 다음 사용자 속성을 설정하기 위해 메서드를 호출할 수 있습니다.

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setFirstName("first_name");
  }
}
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setFirstName("first_name")
}

Braze는 BrazeUser 클래스 내에서 다음 사용자 속성을 설정하기 위해 미리 정의된 메서드를 제공합니다. 메서드 사양에 대해서는 우리 KDoc를 참조하십시오.

  • 이름
  • 국가
  • 언어
  • 생년월일
  • 이메일
  • 성별
  • 출생지
  • 전화번호

사용자 지정 사용자 속성

기본 사용자 속성 외에도, Braze는 여러 가지 데이터 유형을 사용하여 커스텀 속성을 정의할 수 있도록 허용합니다. 각 속성의 세분화 옵션에 대한 자세한 정보는 사용자 데이터 수집을 참조하십시오.

사용자 지정 속성 설정

string 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", "your_attribute_value");
  }
}
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", "your_attribute_value")
}

int 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
7
8
9
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_INT_VALUE);
    
    // Integer attributes may also be incremented using code like the following:
    brazeUser.incrementCustomUserAttribute("your_attribute_key", YOUR_INCREMENT_VALUE);
  }
}
1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_INT_VALUE)

  // Integer attributes may also be incremented using code like the following:
  brazeUser.incrementCustomUserAttribute("your_attribute_key", YOUR_INCREMENT_VALUE)
}

long 정수 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_LONG_VALUE);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_LONG_VALUE)
}

float 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_FLOAT_VALUE);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_FLOAT_VALUE)
}

double 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_DOUBLE_VALUE);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_DOUBLE_VALUE)
}

boolean 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_BOOLEAN_VALUE);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_BOOLEAN_VALUE)
}
1
2
3
4
5
6
7
8
9
10
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_DATE_VALUE);
    // This method will assign the current time to a custom attribute at the time the method is called:
    brazeUser.setCustomUserAttributeToNow("your_attribute_key");
    // This method will assign the date specified by SECONDS_FROM_EPOCH to a custom attribute:
    brazeUser.setCustomUserAttributeToSecondsFromEpoch("your_attribute_key", SECONDS_FROM_EPOCH);
  }
});
1
2
3
4
5
6
7
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setCustomUserAttribute("your_attribute_key", YOUR_DATE_VALUE)
  // This method will assign the current time to a custom attribute at the time the method is called:
  brazeUser.setCustomUserAttributeToNow("your_attribute_key")
  // This method will assign the date specified by SECONDS_FROM_EPOCH to a custom attribute:
  brazeUser.setCustomUserAttributeToSecondsFromEpoch("your_attribute_key", SECONDS_FROM_EPOCH)
}

커스텀 속성 배열의 최대 요소 개수 기본값은 25개입니다. 개별 배열의 최대치는 Braze 대시보드의 데이터 설정 > 커스텀 속성에서 최대 100개로 늘릴 수 있습니다. 최대 요소 수를 초과하는 배열은 최대 요소 수를 포함하도록 잘립니다. 커스텀 속성 배열과 해당 동작에 대한 자세한 내용은 배열에 대한 설명서를 참조하세요.

1
2
3
4
5
6
7
8
9
10
11
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    // Setting a custom attribute with an array value
    brazeUser.setCustomAttributeArray("your_attribute_key", testSetArray);
    // Adding to a custom attribute with an array value
    brazeUser.addToCustomAttributeArray("your_attribute_key", "value_to_add");
    // Removing a value from an array type custom attribute
    brazeUser.removeFromCustomAttributeArray("your_attribute_key", "value_to_remove");
  }
});
1
2
3
4
5
6
7
8
Braze.getInstance(context).getCurrentUser { brazeUser ->
  // Setting a custom attribute with an array value
  brazeUser.setCustomAttributeArray("your_attribute_key", testSetArray)
  // Adding to a custom attribute with an array value
  brazeUser.addToCustomAttributeArray("your_attribute_key", "value_to_add")
  // Removing a value from an array type custom attribute
  brazeUser.removeFromCustomAttributeArray("your_attribute_key", "value_to_remove")
}

사용자 지정 속성 설정 해제하기

사용자 지정 속성은 다음 방법을 사용하여 설정 해제할 수도 있습니다:

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.unsetCustomUserAttribute("your_attribute_key");
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.unsetCustomUserAttribute("your_attribute_key")
}

REST API 사용하기

사용자 속성을 설정하거나 해제하기 위해 우리의 REST API를 사용할 수도 있습니다. 자세한 정보는 사용자 데이터 엔드포인트를 참조하십시오.

사용자 구독 설정

사용자에 대한 가입(이메일 또는 푸시)을 설정하려면 각각 setEmailNotificationSubscriptionType() 또는 setPushNotificationSubscriptionType() 함수를 호출합니다. 이 두 함수 모두 열거형 NotificationSubscriptionType 을 인자로 받습니다. 이 유형에는 세 가지 상태가 있습니다:

이메일 구독 설정

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setEmailNotificationSubscriptionType(emailNotificationSubscriptionType);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setEmailNotificationSubscriptionType(emailNotificationSubscriptionType)
}

푸시 알림 구독 설정

1
2
3
4
5
6
Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
  @Override
  public void onSuccess(BrazeUser brazeUser) {
    brazeUser.setPushNotificationSubscriptionType(pushNotificationSubscriptionType);
  }
});
1
2
3
Braze.getInstance(context).getCurrentUser { brazeUser ->
  brazeUser.setPushNotificationSubscriptionType(pushNotificationSubscriptionType)
}

Prerequisites

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

Default user attributes

Supported attributes

The following attributes should be set on the Braze.User object:

  • firstName
  • lastName
  • email
  • dateOfBirth
  • country
  • language
  • homeCity
  • phone
  • gender

Setting default attributes

To set a default user attribute, set the appropriate field on the shared Braze.User object. The following is an example of setting the first name attribute:

1
AppDelegate.braze?.user.set(firstName: "Alex")
1
[AppDelegate.braze.user setFirstName:@"Alex"];

Unsetting default attributes

To unset a default user attribute, pass nil to the relevant method.

1
AppDelegate.braze?.user.set(firstName: nil)
1
[AppDelegate.braze.user setFirstName:nil];

Custom user attributes

In addition to the default user attributes, Braze also allows you to define custom attributes using several different data types. For more information on each attribute’s segmentation option, see User data collection.

Setting custom attributes

To set a custom attribute with a string value:

1
AppDelegate.braze?.user.setCustomAttribute(key: "your_attribute_key", value: "your_attribute_value")
1
[AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" stringValue:"your_attribute_value"];

To set a custom attribute with an integer value:

1
AppDelegate.braze?.user.setCustomAttribute(key: "your_attribute_key", value: yourIntegerValue)
1
[AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andIntegerValue:yourIntegerValue];

Braze treats float and double values the same within our database. To set a custom attribute with a double value:

1
AppDelegate.braze?.user.setCustomAttribute(key: "your_attribute_key", value: yourDoubleValue)
1
[AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andDoubleValue:yourDoubleValue];

To set a custom attribute with a boolean value:

1
AppDelegate.braze?.user.setCustomAttribute("your_attribute_key", value: yourBoolValue)
1
[AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andBOOLValue:yourBOOLValue];

To set a custom attribute with a date value:

1
AppDelegate.braze?.user.setCustomAttribute("your_attribute_key", dateValue:yourDateValue)
1
[AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andDateValue:yourDateValue];

The maximum number of elements in custom attribute arrays defaults to 25. Arrays exceeding the maximum number of elements will be truncated to contain the maximum number of elements. The maximum for individual arrays can be increased to up to 100. If you would like this maximum increased, reach out to your customer service manager.

To set a custom attribute with an array value:

1
2
3
4
5
6
// Setting a custom attribute with an array value
AppDelegate.braze?.user.setCustomAttributeArray(key: "array_name", array: ["value1",  "value2"])
// Adding to a custom attribute with an array value
AppDelegate.braze?.user.addToCustomAttributeArray(key: "array_name", value: "value3")
// Removing a value from an array type custom attribute
AppDelegate.braze?.user.removeFromCustomAttributeArray(key: "array_name", value: "value2")
1
2
3
4
5
6
7
8
// Setting a custom attribute with an array value
[AppDelegate.braze.user setCustomAttributeArrayWithKey:@"array_name" array:@[@"value1",  @"value2"]];
// Adding to a custom attribute with an array value
[AppDelegate.braze.user addToCustomAttributeArrayWithKey:@"array_name" value:@"value3"];
// Removing a value from an array type custom attribute
[AppDelegate.braze.user removeFromCustomAttributeArrayWithKey:@"array_name" value:@"value2"];
// Removing an entire array and key
[AppDelegate.braze.user setCustomAttributeArrayWithKey:@"array_name" array:nil];

Incrementing or decrementing custom attributes

This code is an example of an incrementing custom attribute. You may increment the value of a custom attribute by any integer or long value:

1
AppDelegate.braze?.user.incrementCustomUserAttribute(key: "your_attribute_key", by: incrementIntegerValue)
1
[AppDelegate.braze.user incrementCustomUserAttribute:@"your_attribute_key" by:incrementIntegerValue];

Unsetting custom attributes

To unset a custom attribute, pass the relevant attribute key to the unsetCustomAttribute method.

1
AppDelegate.braze?.user.unsetCustomAttribute(key: "your_attribute_key")

To unset a custom attribute, pass the relevant attribute key to the unsetCustomAttributeWithKey method.

1
[AppDelegate.braze.user unsetCustomAttributeWithKey:@"your_attribute_key"];

Nesting custom attributes

You can also nest properties within custom attributes. In the following example, a favorite_book object with nested properties is set as a custom attribute on the user profile. For more details, refer to Nested Custom Attributes.

1
2
3
4
5
6
7
let favoriteBook: [String: Any?] = [
  "title": "The Hobbit",
  "author": "J.R.R. Tolkien",
  "publishing_date": "1937"
]

braze.user.setCustomAttribute(key: "favorite_book", dictionary: favoriteBook)
1
2
3
4
5
6
7
NSDictionary *favoriteBook = @{
  @"title": @"The Hobbit",
  @"author": @"J.R.R. Tolkien",
  @"publishing_date": @"1937"
};

[AppDelegate.braze.user setCustomAttributeWithKey:@"favorite_book" dictionary:favoriteBook];

Using the REST API

You can also use our REST API to set or unset user attributes. For more information, refer to User Data Endpoints.

Setting user subscriptions

To set up a subscription for your users (either email or push), call the functions set(emailSubscriptionState:) or set(pushNotificationSubscriptionState:), respectively. Both of these functions take the enum type Braze.User.SubscriptionState as arguments. This type has three different states:

Users who grant permission for an app to send them push notifications default to the status of optedIn as iOS requires an explicit opt-in.

Users will be set to subscribed automatically upon receipt of a valid email address; however, we suggest that you establish an explicit opt-in process and set this value to optedIn upon receipt of explicit consent from your user. Refer to Managing user subscriptions for more details.

Setting email subscriptions

1
AppDelegate.braze?.user.set(emailSubscriptionState: Braze.User.SubscriptionState)
1
[AppDelegate.braze.user setEmailSubscriptionState: BRZUserSubscriptionState]

Setting push notification subscriptions

1
AppDelegate.braze?.user.set(pushNotificationSubscriptionState: Braze.User.SubscriptionState)
1
[AppDelegate.braze.user setPushNotificationSubscriptionState: BRZUserSubscriptionState]

Refer to Managing user subscriptions for more details.

Prerequisites

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

기본 사용자 속성

사용자에 대한 기본 속성을 설정하려면, Braze 인스턴스에서 getCurrentUser() 메서드를 호출하여 앱의 현재 사용자에 대한 참조를 가져옵니다. 그런 다음 사용자 속성을 설정하기 위해 메서드를 호출할 수 있습니다.

1
braze.getUser().setFirstName("SomeFirstName");
1
braze.getUser().setGender(braze.User.Genders.FEMALE);
1
braze.getUser().setDateOfBirth(2000, 12, 25);

Google Tag Manager를 사용하여 표준 사용자 속성(예: 사용자의 이름)은 커스텀 사용자 속성과 동일한 방식으로 기록되어야 합니다. 표준 속성으로 전달하는 값이 사용자 클래스 문서에 지정된 예상 형식과 일치하는지 확인합니다.

예를 들어 성별 속성은 다음 중 하나를 값으로 사용할 수 있습니다. "m" | "f" | "o" | "u" | "n" | "p". 따라서 사용자의 성별을 여성으로 설정하려면 다음 내용으로 사용자 지정 HTML 태그를 만드세요:

1
2
3
<script>
window.braze.getUser().setGender("f")
</script>

Braze는 User 클래스 내에서 다음 사용자 속성을 설정하기 위해 미리 정의된 메서드를 제공합니다:

  • 이름
  • 언어
  • 국가
  • 생년월일
  • 이메일
  • 성별
  • 출생지
  • 전화번호

사용자 지정 사용자 속성

기본 사용자 속성 메서드 외에도, 사용자에 대해 커스텀 속성을 설정할 수 있습니다. 전체 메서드 사양은 우리의 JSDocs를 참조하십시오.

string 값으로 커스텀 속성을 설정하려면:

1
2
3
4
braze.getUser().setCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  YOUR_STRING_VALUE
);

integer 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
7
8
9
10
braze.getUser().setCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  YOUR_INT_VALUE
);

// Integer attributes may also be incremented using code like the following
braze.getUser().incrementCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  THE_INTEGER_VALUE_BY_WHICH_YOU_WANT_TO_INCREMENT_THE_ATTRIBUTE
);

date 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
braze.getUser().setCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  YOUR_DATE_VALUE
);

// This method will assign the current time to a custom attribute at the time the method is called
braze.getUser().setCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  new Date()
);

// This method will assign the date specified by secondsFromEpoch to a custom attribute
braze.getUser().setCustomUserAttribute(
  YOUR_ATTRIBUTE_KEY_STRING,
  new Date(secondsFromEpoch * 1000)
);

커스텀 속성 배열에는 최대 25개의 요소를 가질 수 있습니다. 수동으로 설정된 개별 배열(자동으로 감지되지 않음)은 Braze 대시보드의 데이터 유형 아래에서 최대 100으로 증가할 수 있습니다. 데이터 설정 > 커스텀 속성. 이 최대치를 늘리고 싶다면, Braze 계정 매니저에게 문의하십시오.

최대 요소 수를 초과하는 배열은 최대 요소 수를 포함하도록 잘립니다.

array 값으로 커스텀 속성을 설정하려면:

1
2
3
4
5
6
7
braze.getUser().setCustomUserAttribute(YOUR_ATTRIBUTE_KEY_STRING, YOUR_ARRAY_OF_STRINGS);

// Adding a new element to a custom attribute with an array value
braze.getUser().addToCustomAttributeArray(YOUR_ATTRIBUTE_KEY_STRING, "new string");

// Removing an element from a custom attribute with an array value
braze.getUser().removeFromCustomAttributeArray(YOUR_ATTRIBUTE_KEY_STRING, "value to be removed");

Google 태그 관리자의 스크립팅 언어 제한으로 인해 사용자 지정 사용자 속성을 사용할 수 없습니다. 사용자 지정 속성을 기록하려면 다음 내용으로 사용자 지정 HTML 태그를 만듭니다:

1
2
3
4
5
<script>
  // Note: If using SDK version 3.x or below, use `window.appboy` instead of `window.braze`
  // Version 4 or greater should use `window.braze`
window.braze.getUser().setCustomUserAttribute("attribute name", "attribute value");
</script>

사용자 지정 속성 설정 해제하기

커스텀 속성은 값을 null로 설정하여 해제할 수 있습니다.

1
braze.getUser().setCustomUserAttribute(YOUR_ATTRIBUTE_KEY_STRING, null);

REST API 사용

사용자 속성을 설정하거나 해제하기 위해 우리의 REST API를 사용할 수도 있습니다. 자세한 내용은 사용자 데이터 엔드포인트를 참조하십시오.

사용자 구독 설정

사용자에 대한 가입(이메일 또는 푸시)을 설정하려면 각각 setEmailNotificationSubscriptionType() 또는 setPushNotificationSubscriptionType() 함수를 호출합니다. 두 함수 모두 enum 유형 braze.User.NotificationSubscriptionTypes을 인수로 사용합니다. 이 유형에는 세 가지 상태가 있습니다:

사용자가 푸시에 등록되면 브라우저에서 알림 허용 또는 차단을 선택하도록 강제하고, 푸시 허용을 선택한 경우 기본적으로 OPTED_IN으로 설정됩니다.

가입 및 명시적 옵트인 구현에 대한 자세한 내용은 사용자 가입 관리를 참조하세요.

이메일에서 사용자를 구독 취소하기

1
braze.getUser().setEmailNotificationSubscriptionType(braze.User.NotificationSubscriptionTypes.UNSUBSCRIBED);

푸시에서 사용자를 구독 취소하기

1
braze.getUser().setPushNotificationSubscriptionType(braze.User.NotificationSubscriptionTypes.UNSUBSCRIBED);

Prerequisites

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

기본 사용자 속성

사용자 속성을 설정하려면 BrazeBinding 객체에서 적절한 메서드를 호출해야 합니다. 다음은 이 메서드를 사용하여 호출할 수 있는 기본 제공 속성 목록입니다.

사용자 지정 사용자 속성

기본 사용자 속성 외에도 Braze는 여러 가지 데이터 유형을 사용하여 커스텀 속성을 정의할 수 있도록 허용합니다. 각 속성의 세분화 옵션에 대한 자세한 내용은 사용자 데이터 수집을 참조하십시오.

사용자 지정 속성 설정

1
AppboyBinding.SetCustomUserAttribute("custom string attribute key", "string custom attribute");
1
2
3
4
// Set Integer Attribute
AppboyBinding.SetCustomUserAttribute("custom int attribute key", 'integer value');
// Increment Integer Attribute
AppboyBinding.IncrementCustomUserAttribute("key", increment(int))
1
AppboyBinding.SetCustomUserAttribute("custom double attribute key", 'double value');
1
AppboyBinding.SetCustomUserAttribute("custom boolean attribute key", 'boolean value');
1
AppboyBinding.SetCustomUserAttributeToNow("custom date attribute key");
1
AppboyBinding.SetCustomUserAttributeToSecondsFromEpoch("custom date attribute key", 'integer value');
1
2
3
4
5
6
// Setting An Array
AppboyBinding.SetCustomUserAttributeArray("key", array(List), sizeOfTheArray(int))
// Adding to an Array
AppboyBinding.AddToCustomUserAttributeArray("key", "Attribute")
// Removing an item from an Array
AppboyBinding.RemoveFromCustomUserAttributeArray("key", "Attribute")

커스텀 속성 해제

커스텀 사용자 속성을 해제하려면 다음 메서드를 사용하십시오:

1
AppboyBinding.UnsetCustomUserAttribute("custom attribute key");

REST API 사용

사용자 속성을 설정하거나 해제하기 위해 REST API를 사용할 수도 있습니다. 자세한 내용은 사용자 데이터 엔드포인트을 참조하십시오.

사용자 구독 설정

사용자를 위한 이메일 또는 푸시 구독을 설정하려면 다음 함수 중 하나를 호출하십시오.

1
2
3
4
5
// Email notifications
AppboyBinding.SetUserEmailNotificationSubscriptionType()

// Push notifications
AppboyBinding.SetPushNotificationSubscriptionType()`

두 함수 모두 Appboy.Models.AppboyNotificationSubscriptionType을 인수로 사용하며, 세 가지 다른 상태가 있습니다:

이메일 구독 설정

1
AppboyBinding.SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);

푸시 알림 구독 설정하기

1
AppboyBinding.SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);

Default User Attributes

Supported attributes

The following attributes should be set on the UBrazeUser object:

  • SetFirstName
  • SetLastName
  • SetEmail
  • SetDateOfBirth
  • SetCountry
  • SetLanguage
  • SetHomeCity
  • SetPhoneNumber
  • SetGender

Setting default attributes

To set a default attribute for a user, call the GetCurrentUser() method on the shared UBrazeUser object to get a reference to the current user of your app. Then you can call methods to set a user attribute.

1
2
3
4
5
UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
    if (BrazeUser) {
        BrazeUser->SetFirstName(TEXT("Alex"));
    }
});

Custom User Attributes

In addition to the default user attributes, Braze also allows you to define custom attributes using several different data types. For more information on each attribute’s segmentation option, see User data collection.

To set a custom attribute with a string value:

1
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), TEXT("your_attribute_value"));

To set a custom attribute with an integer value:

1
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), 42);

Braze treats float and double values the same within our database. To set a custom attribute with a double value:

1
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), 3.14);

To set a custom attribute with a boolean value:

1
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), true);

To set a custom attribute with a date value:

1
2
FDateTime YourDateTime = FDateTime(2023, 5, 10);
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), YourDateTime);

To set a custom attribute with an array value:

1
2
3
4
5
6
7
8
9
// Setting a custom attribute with an array value
TArray<FString> Values = {TEXT("value1"), TEXT("value2")};
UBrazeUser->SetCustomAttributeArray(TEXT("array_name"), Values);

// Adding to a custom attribute with an array value
UBrazeUser->AddToCustomAttributeArray(TEXT("array_name"), TEXT("value3"));

// Removing a value from an array type custom attribute
UBrazeUser->RemoveFromCustomAttributeArray(TEXT("array_name"), TEXT("value2"));

Setting user subscriptions

To set up an email or push subscription for your users, you can use the following methods.

Setting email subscription

1
2
3
4
5
UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
    if (BrazeUser) {
        BrazeUser->SetEmailSubscriptionType(EBrazeSubscriptionType::Subscribed);
    }
});

Setting attribution data

1
2
3
4
5
UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
    if (BrazeUser) {
        BrazeUser->SetPushSubscriptionType(EBrazeSubscriptionType::OptedIn);
    }
});
이 페이지가 얼마나 도움이 되었나요?
New Stuff!