Prerequisites
이 기능을 사용하려면 먼저 Android Braze SDK를 통합해야 합니다.
기본 사용자 속성
미리 정의된 메서드
Braze는 BrazeUser 클래스 내에서 다음 사용자 속성을 설정하기 위한 미리 정의된 메서드를 제공합니다. 메서드 사양은 우리 KDoc을 참조하십시오.
- First name
- 성
- 국가
- 언어
- 생년월일
- 이메일
- 성별
- 출생지
- Phone number
note:
이름과 성, 국가, 출생지와 같은 모든 문자열 값은 255자로 제한됩니다.
기본 속성 설정
사용자에 대한 기본 속성을 설정하려면 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")
}
|
기본 속성 해제
사용자 속성을 해제하려면 관련 메서드에 null을 전달하십시오.
1
2
3
4
5
6
| Braze.getInstance(context).getCurrentUser(new IValueCallback<BrazeUser>() {
@Override
public void onSuccess(BrazeUser brazeUser) {
brazeUser.setFirstName(null);
}
}
|
1
2
3
| Braze.getInstance(context).getCurrentUser { brazeUser ->
brazeUser.setFirstName(null)
}
|
사용자 지정 사용자 속성
기본 사용자 속성 외에도 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)
}
|
warning:
이 메서드에서 Braze에 전달된 날짜는 ISO 8601 형식(e.g 2013-07-16T19:20:30+01:00) 또는 yyyy-MM-dd'T'HH:mm:ss:SSSZ 형식(e.g 2016-12-14T13:32:31.601-0800)이어야 합니다
커스텀 속성 배열의 최대 요소 개수 기본값은 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")
}
|
커스텀 속성 해제
커스텀 속성을 해제하려면 관련 속성 키를 unsetCustomUserAttribute 메서드에 전달하십시오.
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")
}
|
커스텀 속성 중첩
커스텀 속성 내에서 속성을 중첩할 수도 있습니다. 다음 예제에서는 중첩 속성이 있는 favorite_book 객체가 사용자 프로필의 커스텀 속성으로 설정됩니다. 자세한 내용은 중첩 커스텀 속성을 참조하십시오.
1
2
3
4
5
6
7
8
9
10
11
12
13
| JSONObject favoriteBook = new JSONObject();
try {
favoriteBook.put("title", "The Hobbit");
favoriteBook.put("author", "J.R.R. Tolkien");
favoriteBook.put("publishing_date", "1937");
} catch (JSONException e) {
e.printStackTrace();
}
braze.getCurrentUser(user -> {
user.setCustomUserAttribute("favorite_book", favoriteBook);
return null;
});
|
1
2
3
4
5
6
7
8
| val favoriteBook = JSONObject()
.put("title", "The Hobbit")
.put("author", "J.R.R. Tolkien")
.put("publishing_date", "1937")
braze.getCurrentUser { user ->
user.setCustomUserAttribute("favorite_book", favoriteBook)
}
|
REST API 사용
REST API를 사용하여 사용자 속성을 설정하거나 해제할 수도 있습니다. 자세한 정보는 사용자 데이터 엔드포인트를 참조하십시오.
사용자 구독 설정
사용자에 대한 가입(이메일 또는 푸시)을 설정하려면 각각 setEmailNotificationSubscriptionType() 또는 setPushNotificationSubscriptionType() 함수를 호출합니다. 이 두 함수 모두 열거형 NotificationSubscriptionType 을 인자로 받습니다. 이 유형에는 세 가지 상태가 있습니다:
| 구독 상태 |
정의 |
OPTED_IN |
구독하고 명시적으로 동의한 경우 |
SUBSCRIBED |
구독 중이지만 명시적으로 옵트인하지 않은 경우 |
UNSUBSCRIBED |
구독 취소 및/또는 명시적 수신 거부 |
important:
Android에서 사용자에게 푸시 알림을 보내기 위해 명시적으로 옵트인할 필요는 없습니다. 사용자가 푸시에 등록되면 기본적으로 OPTED_IN 대신 SUBSCRIBED로 설정됩니다. 가입 및 명시적 옵트인 구현에 대한 자세한 내용은 사용자 가입 관리를 참조하세요.
이메일 구독 설정
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를 통합해야 합니다.
기본 사용자 속성
Supported attributes
Braze.User 객체에 다음 속성을 설정해야 합니다:
firstName
lastName
email
dateOfBirth
country
language
homeCity
phone
gender
기본 속성 설정
기본 사용자 속성을 설정하려면 공유 Braze.User 객체의 적절한 필드를 설정하십시오. 다음은 이름 속성 설정 예제입니다.
1
| AppDelegate.braze?.user.set(firstName: "Alex")
|
1
| [AppDelegate.braze.user setFirstName:@"Alex"];
|
기본 속성 해제
기본 사용자 속성을 해제하려면 관련 메서드에 nil을 전달하십시오.
1
| AppDelegate.braze?.user.set(firstName: nil)
|
1
| [AppDelegate.braze.user setFirstName:nil];
|
사용자 지정 사용자 속성
기본 사용자 속성 외에도 Braze는 여러 가지 데이터 유형을 사용하여 커스텀 속성을 정의할 수 있도록 허용합니다. 각 속성의 세분화 옵션에 대한 자세한 내용은 사용자 데이터 수집을 참조하십시오.
important:
커스텀 속성 값의 최대 길이는 255자이며, 이보다 긴 값은 잘립니다. 자세한 내용은 Braze.User를 참조하십시오.
사용자 지정 속성 설정
string 값으로 커스텀 속성을 설정하려면:
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"];
|
integer 값으로 커스텀 속성을 설정하려면:
1
| AppDelegate.braze?.user.setCustomAttribute(key: "your_attribute_key", value: yourIntegerValue)
|
1
| [AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andIntegerValue:yourIntegerValue];
|
Braze는 데이터베이스 내에서 float 및 double 값을 동일하게 처리합니다. 배정밀도 값으로 커스텀 속성을 설정하려면:
1
| AppDelegate.braze?.user.setCustomAttribute(key: "your_attribute_key", value: yourDoubleValue)
|
1
| [AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andDoubleValue:yourDoubleValue];
|
boolean 값으로 커스텀 속성을 설정하려면:
1
| AppDelegate.braze?.user.setCustomAttribute("your_attribute_key", value: yourBoolValue)
|
1
| [AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andBOOLValue:yourBOOLValue];
|
date 값으로 커스텀 속성을 설정하려면:
1
| AppDelegate.braze?.user.setCustomAttribute("your_attribute_key", dateValue:yourDateValue)
|
1
| [AppDelegate.braze.user setCustomAttributeWithKey:@"your_attribute_key" andDateValue:yourDateValue];
|
커스텀 속성 배열의 최대 요소 개수 기본값은 25개입니다. 최대 요소 수를 초과하는 배열은 최대 요소 수를 포함하도록 잘립니다. 개별 배열의 최댓값은 최대 100개까지 늘릴 수 있습니다. 이 최대 한도를 늘리려면 고객 서비스 관리자에게 문의하세요.
array 값으로 커스텀 속성을 설정하려면:
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];
|
커스텀 속성 증가 또는 감소
이 코드는 증분 사용자 지정 속성의 예시입니다. 사용자 정의 속성의 값을 integer 또는 long 값으로 증가시킬 수 있습니다:
1
| AppDelegate.braze?.user.incrementCustomUserAttribute(key: "your_attribute_key", by: incrementIntegerValue)
|
1
| [AppDelegate.braze.user incrementCustomUserAttribute:@"your_attribute_key" by:incrementIntegerValue];
|
사용자 정의 속성 해제
사용자 정의 속성을 해제하려면 관련 속성 키를 unsetCustomAttribute 메서드에 전달하십시오.
1
| AppDelegate.braze?.user.unsetCustomAttribute(key: "your_attribute_key")
|
사용자 정의 속성을 해제하려면 관련 속성 키를 unsetCustomAttributeWithKey 메서드에 전달하십시오.
1
| [AppDelegate.braze.user unsetCustomAttributeWithKey:@"your_attribute_key"];
|
사용자 정의 속성 중첩
사용자 정의 속성 내에 속성을 중첩할 수도 있습니다. 다음 예제에서는 중첩된 속성을 가진 favorite_book 객체가 사용자 프로필의 사용자 정의 속성으로 설정됩니다. 자세한 내용은 중첩된 사용자 정의 속성을 참조하십시오.
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];
|
REST API 사용
REST API를 사용하여 사용자 속성을 설정하거나 해제할 수도 있습니다. 자세한 정보는 사용자 데이터 엔드포인트를 참조하십시오.
사용자 구독 설정
사용자에 대한 가입(이메일 또는 푸시)을 설정하려면 각각 set(emailSubscriptionState:) 또는 set(pushNotificationSubscriptionState:) 함수를 호출합니다. 이 두 함수 모두 열거형 Braze.User.SubscriptionState 을 인자로 받습니다. 이 유형에는 세 가지 상태가 있습니다:
| 구독 상태 |
정의 |
optedIn |
구독하고 명시적으로 동의한 경우 |
subscribed |
구독 중이지만 명시적으로 옵트인하지 않은 경우 |
unsubscribed |
구독 취소 및/또는 명시적 수신 거부 |
앱에서 푸시 알림을 보낼 수 있도록 권한을 부여한 사용자의 기본 상태는 optedIn입니다. iOS에서는 명시적인 옵트인이 필요하기 때문입니다.
유효한 이메일 주소가 수신되면 subscribed 으로 자동 설정되지만, 명시적인 옵트인 프로세스를 설정하고 사용자의 명시적인 동의를 받은 후 이 값을 optedIn 으로 설정하는 것이 좋습니다. 자세한 내용은 사용자 구독 관리하기를 참조하세요.
이메일 구독 설정
1
| AppDelegate.braze?.user.set(emailSubscriptionState: Braze.User.SubscriptionState)
|
1
| [AppDelegate.braze.user setEmailSubscriptionState: BRZUserSubscriptionState]
|
푸시 알림 구독 설정하기
1
| AppDelegate.braze?.user.set(pushNotificationSubscriptionState: Braze.User.SubscriptionState)
|
1
| [AppDelegate.braze.user setPushNotificationSubscriptionState: BRZUserSubscriptionState]
|
자세한 내용은 사용자 구독 관리하기를 참조하세요.
Prerequisites
Before you can use this feature, you’ll need to integrate the Web Braze SDK.
기본 사용자 속성
미리 정의된 메서드
Braze는 User 클래스 내에서 다음 사용자 속성을 설정하기 위해 미리 정의된 메서드를 제공합니다:
- 이름
- Last Name
- 언어
- 국가
- 생년월일
- 이메일
- 성별
- 출생지
- 전화번호
기본 속성 설정
사용자에 대한 기본 속성을 설정하려면, Braze 인스턴스에서 getUser() 메서드를 호출하여 앱의 현재 사용자에 대한 참조를 가져옵니다. 그런 다음 사용자 속성을 설정하기 위해 메서드를 호출할 수 있습니다.
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>
|
기본 속성 해제
기본 사용자 속성을 해제하려면 관련 메서드에 null을 전달합니다. For example:
1
| braze.getUser().setFirstName(null);
|
1
| braze.getUser().setGender(null);
|
1
| braze.getUser().setDateOfBirth(null, null, null);
|
사용자 지정 사용자 속성
사용자 지정 속성 설정
기본 사용자 속성 메서드 외에도 사용자에 대해 커스텀 속성을 설정할 수 있습니다. 전체 메서드 사양은 우리 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");
|
important:
이 메서드를 통해 Braze에 전달되는 날짜는 JavaScript 날짜 객체여야 합니다.
important:
커스텀 속성 키와 값은 최대 255자만 가질 수 있습니다. 유효한 커스텀 속성 값에 대한 자세한 내용은 참조 설명서를 참조하십시오.
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>
|
important:
GTM 템플릿은 이벤트 또는 구매에 중첩된 속성을 지원하지 않습니다. 앞의 HTML을 사용하여 중첩된 속성이 필요한 이벤트 또는 구매를 기록할 수 있습니다.
커스텀 속성 해제
커스텀 속성을 해제하려면 관련 메서드에 null을(를) 전달하십시오.
1
| braze.getUser().setCustomUserAttribute(YOUR_ATTRIBUTE_KEY_STRING, null);
|
커스텀 속성 중첩
커스텀 속성 내에서 속성을 중첩할 수도 있습니다. 다음 예제에서는 중첩 속성이 있는 favorite_book 객체가 사용자 프로필의 커스텀 속성으로 설정됩니다. 자세한 내용은 중첩 커스텀 속성를 참조하십시오.
1
2
3
4
5
6
7
8
9
| import * as braze from "@braze/web-sdk";
const favoriteBook = {
title: "The Hobbit",
author: "J.R.R. Tolkien",
publishing_date: "1937"
};
braze.getUser().setCustomUserAttribute("favorite_book", favoriteBook);
|
REST API 사용
REST API를 사용하여 사용자 속성을 설정하거나 해제할 수도 있습니다. 자세한 정보는 사용자 데이터 엔드포인트를 참조하십시오.
사용자 구독 설정
사용자에 대한 가입(이메일 또는 푸시)을 설정하려면 각각 setEmailNotificationSubscriptionType() 또는 setPushNotificationSubscriptionType() 함수를 호출합니다. 두 함수 모두 enum 유형 braze.User.NotificationSubscriptionTypes을(를) 인수로 사용합니다. 이 유형에는 세 가지 상태가 있습니다:
| 구독 상태 |
정의 |
braze.User.NotificationSubscriptionTypes.OPTED_IN |
구독하고 명시적으로 동의한 경우 |
braze.User.NotificationSubscriptionTypes.SUBSCRIBED |
구독 중이지만 명시적으로 옵트인하지 않은 경우 |
braze.User.NotificationSubscriptionTypes.UNSUBSCRIBED |
구독 취소 및/또는 명시적 수신 거부 |
사용자가 푸시에 등록되면 브라우저에서 알림 허용 또는 차단을 선택하도록 강제하고, 푸시 허용을 선택한 경우 기본적으로 OPTED_IN으로 설정됩니다.
가입 및 명시적 옵트인 구현에 대한 자세한 내용은 사용자 가입 관리를 참조하세요.
사용자를 이메일 구독 해지
1
| braze.getUser().setEmailNotificationSubscriptionType(braze.User.NotificationSubscriptionTypes.UNSUBSCRIBED);
|
사용자를 푸시 구독 해지
1
| braze.getUser().setPushNotificationSubscriptionType(braze.User.NotificationSubscriptionTypes.UNSUBSCRIBED);
|
Prerequisites
이 기능을 사용하려면 먼저 Unity Braze SDK를 통합해야 합니다.
기본 사용자 속성
미리 정의된 메서드
Braze는 BrazeBinding 객체를 사용하여 다음 사용자 속성을 설정하기 위한 미리 정의된 메서드를 제공합니다. 자세한 내용은 Braze Unity 선언 파일을 참조하십시오.
- First name
- Last name
- 사용자 이메일
- Gender
- 생년월일
- 사용자 국가
- 사용자 거주 구/군/시
- 사용자 이메일 구독
- 사용자 푸시 구독
- 사용자 전화번호
기본 속성 설정
기본 속성을 설정하려면 BrazeBinding 객체에서 관련 메서드를 호출하십시오.
1
| BrazeBinding.SetUserFirstName("first name");
|
1
| BrazeBinding.SetUserLastName("last name");
|
1
| BrazeBinding.SetUserGender(Appboy.Models.Gender);
|
1
| BrazeBinding.SetUserDateOfBirth("year(int)", "month(int)", "day(int)");
|
1
| BrazeBinding.SetUserCountry("country name");
|
1
| BrazeBinding.SetUserHomeCity("city name");
|
1
| BrazeBinding.SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType);
|
1
| BrazeBinding.SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType);
|
1
| BrazeBinding.SetUserPhoneNumber("phone number");
|
기본 속성 해제
기본 사용자 속성을 해제하려면 관련 메서드에 null을 전달하십시오.
1
| BrazeBinding.SetUserFirstName(null);
|
사용자 지정 사용자 속성
기본 사용자 속성 외에도 Braze는 여러 다른 데이터 유형을 사용하여 커스텀 속성을 정의할 수 있도록 허용합니다. 각 속성의 세분화 옵션에 대한 자세한 내용은 사용자 데이터 수집](/docs/ko/developer_guide/analytics)을 참조하십시오.
사용자 지정 속성 설정
커스텀 속성을 설정하려면 속성 유형에 해당하는 메서드를 사용하십시오:
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');
|
note:
Braze에 전달된 날짜는 ISO 8601 형식(예: 2013-07-16T19:20:30+01:00) 또는 yyyy-MM-dd'T'HH:mm:ss:SSSZ 형식(예: 2016-12-14T13:32:31.601-0800)이어야 합니다.
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")
|
important:
커스텀 속성 값의 최대 길이는 255자이며, 이보다 긴 값은 잘립니다.
커스텀 속성 해제
커스텀 속성을 해제하려면 관련 속성 키를 UnsetCustomUserAttribute 메서드에 전달하십시오.
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을(를) 인수로 사용하며, 세 가지 다른 상태가 있습니다:
| Subscription Status |
정의 |
OPTED_IN |
구독하고 명시적으로 동의한 경우 |
SUBSCRIBED |
구독 중이지만 명시적으로 옵트인하지 않은 경우 |
UNSUBSCRIBED |
구독 취소 및/또는 명시적 수신 거부 |
note:
Windows에서 사용자에게 푸시 알림을 보내기 위해 명시적으로 옵트인할 필요는 없습니다. 사용자가 푸시에 등록되면 기본적으로 OPTED_IN 대신 SUBSCRIBED로 설정됩니다. 자세한 내용은 설명서에서 가입 및 명시적 옵트인 구현을 참조하세요.
| 구독 유형 |
설명 |
EmailNotificationSubscriptionType |
사용자는 유효한 이메일 주소를 수신하면 자동으로 SUBSCRIBED 로 설정됩니다. 그러나 명시적인 옵트인 프로세스를 설정하고 사용자의 명시적인 동의를 받은 후 이 값을 OPTED_IN으로 설정하는 것이 좋습니다. 자세한 내용은 사용자 구독 변경 문서를 참조하세요. |
PushNotificationSubscriptionType |
사용자는 유효한 푸시 등록 시 자동으로 SUBSCRIBED 로 설정됩니다. 그러나 명시적인 옵트인 프로세스를 설정하고 사용자의 명시적인 동의를 받은 후 이 값을 OPTED_IN으로 설정하는 것이 좋습니다. 자세한 내용은 사용자 구독 변경 문서를 참조하세요. |
note:
이러한 유형은 Appboy.Models.AppboyNotificationSubscriptionType에 해당합니다.
이메일 구독 설정
1
| AppboyBinding.SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);
|
푸시 알림 구독 설정하기
1
| AppboyBinding.SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);
|
기본 사용자 속성
Supported attributes
UBrazeUser 객체에 다음 속성을 설정해야 합니다:
SetFirstName
SetLastName
SetEmail
SetDateOfBirth
SetCountry
SetLanguage
SetHomeCity
SetPhoneNumber
SetGender
기본 속성 설정
사용자에 대한 기본 속성을 설정하려면, 공유 UBrazeUser 객체에서 GetCurrentUser() 메서드를 호출하여 앱의 현재 사용자에 대한 참조를 가져옵니다. 그런 다음 사용자 속성을 설정하는 메서드를 호출할 수 있습니다.
1
2
3
4
5
| UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
if (BrazeUser) {
BrazeUser->SetFirstName(TEXT("Alex"));
}
});
|
사용자 지정 사용자 속성
기본 사용자 속성 외에도, Braze는 여러 가지 데이터 유형을 사용하여 커스텀 속성을 정의할 수 있도록 허용합니다. 각 속성의 세분화 옵션에 대한 자세한 내용은 사용자 데이터 수집을 참조하십시오.
string 값으로 커스텀 속성을 설정하려면:
1
| UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), TEXT("your_attribute_value"));
|
integer 값으로 커스텀 속성을 설정하려면:
1
| UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), 42);
|
Braze는 데이터베이스 내에서 float 및 double 값을 동일하게 처리합니다. 배정밀도 값으로 커스텀 속성을 설정하려면:
1
| UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), 3.14);
|
boolean 값으로 커스텀 속성을 설정하려면:
1
| UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), true);
|
date 값으로 커스텀 속성을 설정하려면:
1
2
| FDateTime YourDateTime = FDateTime(2023, 5, 10);
UBrazeUser->SetCustomUserAttribute(TEXT("your_attribute_key"), YourDateTime);
|
array 값으로 커스텀 속성을 설정하려면:
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"));
|
important:
커스텀 속성 값의 최대 길이는 255자이며, 이보다 긴 값은 잘립니다.
사용자 구독 설정
사용자를 위한 이메일 또는 푸시 구독을 설정하려면, 다음 메서드를 사용할 수 있습니다.
이메일 구독 설정
1
2
3
4
5
| UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
if (BrazeUser) {
BrazeUser->SetEmailSubscriptionType(EBrazeSubscriptionType::Subscribed);
}
});
|
기여도 데이터 설정
1
2
3
4
5
| UBraze->GetCurrentUser([](UBrazeUser* BrazeUser) {
if (BrazeUser) {
BrazeUser->SetPushSubscriptionType(EBrazeSubscriptionType::OptedIn);
}
});
|