カスタム属性の設定
Braze では、ユーザーに属性を割り当てるメソッドが提供されています。ダッシュボード上のこれらの属性に従って、ユーザーのフィルター処理とセグメント化を行うことができます。
実装前に、ベストプラクティス記事のカスタムイベント、カスタム属性、および購入イベントで提供されるセグメンテーションオプションの例を確認してください。
デフォルトユーザー属性の割り当て
ユーザ属性を割り当てるには、BrazeBinding オブジェクトで適切なメソッドを呼び出す必要があります。以下は、このメソッドを使用して呼び出すことができる組み込み属性のリストです。
名
AppboyBinding.SetUserFirstName("first name");
姓
AppboyBinding.SetUserLastName("last name");
ユーザーのメールアドレス
AppboyBinding.SetUserEmail("email@email.com");
Brazeを介してメールを送信していなくても、メールアドレスを設定することはまだ価値があります。電子メールを使用すると、個々のユーザープロファイルを検索しやすくなり、問題が発生したときにトラブルシューティングが容易になります。
性別
AppboyBinding.SetUserGender(Appboy.Models.Gender);
生年月日
AppboyBinding.SetUserDateOfBirth("year(int)", "month(int)", "day(int)");
ユーザー国
AppboyBinding.SetUserCountry("country name");
ユーザーホームシティ
AppboyBinding.SetUserHomeCity("city name");
ユーザメールサブスクリプション
AppboyBinding.SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType);
ユーザープッシュサブスクリプション
AppboyBinding.SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType);
USER_PHONE_NUMBER
AppboyBinding.SetUserPhoneNumber("phone number");
カスタムユーザー属性の割り当て
Braze では、デフォルトユーザー属性以外にも、複数の異なるデータ型を使用してカスタム属性を定義できます。 これらの各属性のセグメンテーションオプションの詳細については、このセクションの“Best Practices” documentation を参照してください。
カスタム属性値を設定する
1
AppboyBinding.SetCustomUserAttribute("custom boolean attribute key", 'boolean value');
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 string attribute key", "string custom attribute");
1
AppboyBinding.SetCustomUserAttributeToNow("custom date attribute key");
1
AppboyBinding.SetCustomUserAttributeToSecondsFromEpoch("custom date attribute key", 'integer value');
Braze に渡される日付は、[ISO 8601][2] 形式、たとえば
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")
カスタム属性の設定解除
カスタム属性は、次のメソッドを使用して設定を解除することもできます。
1
AppboyBinding.UnsetCustomUserAttribute("custom attribute key");
REST API によるカスタム属性の設定
REST API を使用してユーザー属性を設定することもできます。これを行うには、ユーザー API のドキュメントを参照してください。
カスタム属性値の制限
カスタム属性値の最大長は 255 文字です。これより長い値は切り捨てられます。
ユーザーサブスクリプションの設定
ユーザのサブスクリプションを設定するには(メールまたはプッシュのいずれか)、関数を呼び出します   
AppboyBinding.SetUserEmailNotificationSubscriptionType() またはAppboyBinding.SetPushNotificationSubscriptionType()。これらの関数はどちらも引数としてパラメータAppboy.Models.AppboyNotificationSubscriptionType を取ります。この型には、次の 3 つの状態があります。
| サブスクリプションステータス | 定義 | 
|---|---|
OPTED_IN | 
      配信登録済み、かつ明示的にオプトイン済み | 
SUBSCRIBED | 
      配信登録済みだが、明示的なオプトインは未実行 | 
UNSUBSCRIBED | 
      配信停止済みまたは明示的にオプトアウト済み、あるいはその両方 | 
Windowsでは、ユーザーにプッシュ通知を送信するために明示的なオプトインは必要ありません。ユーザーがプッシュ登録されると、デフォルトで
OPTED_INではなくSUBSCRIBEDに設定されます。詳細については、サブスクリプションと明示的なopt-ins の実装に関するドキュメントを参照してください。
EmailNotificationSubscriptionType- 有効なメールアドレスを受信すると、ユーザは自動的に
SUBSCRIBEDに設定されます。ただし、明示的なオプトインプロセスを確立し、ユーザーから明示的な同意を受け取った時点でこの値をOPTED_INに設定することをお勧めします。詳細については、ユーザーサブスクリプションの変更のドキュメントを参照してください。 
- 有効なメールアドレスを受信すると、ユーザは自動的に
 PushNotificationSubscriptionType- ユーザは、有効なプッシュ登録時に自動的に
SUBSCRIBEDに設定されます。ただし、明示的なオプトインプロセスを確立し、ユーザーから明示的な同意を受け取った時点でこの値をOPTED_INに設定することをお勧めします。詳細については、ユーザーサブスクリプションの変更のドキュメントを参照してください。 
- ユーザは、有効なプッシュ登録時に自動的に
 
これらの型は
Appboy.Models.AppboyNotificationSubscriptionTypeに属します
サンプルコード
Email, Subscription
1
AppboyBinding.SetUserEmailNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);
プッシュ通知サブスクリプション
1
AppboyBinding.SetUserPushNotificationSubscriptionType(AppboyNotificationSubscriptionType.OPTED_IN);
   Edit this page on GitHub