Skip to content

ルールに基づく推奨事項

ルールベースのレコメンドエンジンは、ユーザデータと製品情報を使用して、メッセージ内の関連する項目をユーザに提案します。これは、Liquidを使用し、Braze catalogsまたはConnected Contentを使用して、ユーザーの動作と属性に基づいてコンテンツを動的にパーソナライズします。

Liquid、カタログ、およびConnected Content の詳細については、以下のBraze Learning コースを参照してください。

カタログレコメンドエンジンの作成

  1. 製品のカタログを作成します。
  2. 製品ごとに、「product_recommendations」という名前の列に、区切り文字で区切られた文字列(パイプ| など) として推奨製品のリストを追加します。
  3. 推奨事項を見つける製品ID をカタログに渡します。
  4. そのカタログアイテムのproduct_recommendations 値を取得し、Liquid split フィルタを使用して区切り文字で分割します。
  5. 1 つ以上のID をカタログに戻して、他の製品の詳細を収集します。

カタログのユースケース

ヘルスフードアプリがあり、ユーザーがアプリに登録されている期間に基づいて異なるレシピを送信するコンテンツカードキャンペーンを作成するとします。

  1. 以下の情報を含む、CSV を使用したカタログの作成とアップロード:
    - id:ユーザーがアプリにサインアップしてからの日数に相関する一意の番号。たとえば、3 は3 日間に相関します。
    - type:レシピカテゴリ(comfortfresh、その他)。
    - title: IDごとに送信されるコンテンツカードのタイトル。「今週のランチを先にする」や「それについてタコをしよう」など。
    - link: レシピ記事へのリンク。
    - image_url:レシピに対応するイメージ。

2.カタログがBrazeにアップロードされたら、選択した数のカタログアイテムのプレビューをチェックして、正確にインポートされた情報を確認します。アイテムはプレビューでランダム化される場合がありますが、これはレコメンドエンジンの出力には影響しません。

3.コンテンツカードキャンペーンを登録します。コンポーザーで、Liquid ロジックを入力して、キャンペーンを受信するユーザと表示するレシピおよびイメージを決定します。この使用例では、Braze はユーザのstart_date (またはサインアップ) をプルし、現在の日付と比較します。日付の違いによって、送信されるコンテンツカードが決まります。

Title:

1
2
3
4
5
6
{% assign start_date = {{custom_attribute.${start_date}}} | date: "%s" %}
{% assign current_date = "now" | date: "%s" %}
{% assign diff = {{current_date}} | minus: {{start_date}} | divided_by: 86400 %}
{% assign days = {{diff}} | round %}
{% catalog_items Healthy_Recipe_Catalog_SMB {{days}} %}
{{ items[0].title }}

メッセージ:

1
2
3
4
5
6
7
8
9
10
{% assign start_date = {{custom_attribute.${start_date}}} | date: "%s" %}
{% assign current_date = "now" | date: "%s" %}
{% assign diff = {{current_date}} | minus: {{start_date}} | divided_by: 86400 %}
{% assign days = {{diff}} | round %}
{% catalog_items Healthy_Recipe_Catalog_SMB {{days}} %}
{% if items[0].title != blank %}
{{ items[0].body }}
{% else %}
{% abort_message('no card for today') %}
{% endif %}

画像:

1
2
3
4
5
6
{% assign start_date = {{custom_attribute.${start_date}}} | date: "%s" %}
{% assign current_date = "now" | date: "%s" %}
{% assign diff = {{current_date}} | minus: {{start_date}} | divided_by: 86400 %}
{% assign days = {{diff}} | round %}
{% catalog_items Healthy_Recipe_Catalog_SMB {{days}} %}
{{ items[0].image_url }}

4.クリック動作セクションで、ユーザがiOS、Android、およびWebデバイスのコンテンツカードをクリックしたときにリダイレクトする場所の液体ロジックを入力します。

1
2
3
4
5
6
{% assign start_date = {{custom_attribute.${start_date}}} | date: "%s" %}
{% assign current_date = "now" | date: "%s" %}
{% assign diff = {{current_date}} | minus: {{start_date}} | divided_by: 86400 %}
{% assign days = {{diff}} | round %}
{% catalog_items Healthy_Recipe_Catalog_SMB {{days}} %}
{{ items[0].link }}



5.Testタブに進み、カスタムユーザユーザとしてプレビューメッセージを選択します。Custom attributeフィールドに日付を入力して、その日付にサインアップしたユーザに送信されるコンテンツカードをプレビューします。

接続コンテンツレコメンドエンジンの作成

  1. 次のいずれかの方法で、接続されたコンテンツエンドポイントを作成します。
    • スプレッドシートをSheetDP のようなサービスを使用してJSON API エンドポイントに変換し、生成されるAPI URL に注意してください
    • カスタム・ビルトイン・ハウス・エンドポイントのビルド、ホスト、および保守
    • 弊社のAlloy partners などのサードパーティパートナー経由で推奨エンジンを購入します。Amazon PersonaliseCertonaDynamic Yield などが含まれます
  2. Connected Content Liquid をメッセージ本文またはContent Block HTML エディタに書き込んで、エンドポイントを呼び出してデータベースを検索します。
  3. 特定のユーザーのプロファイルで見つかったカスタム属性値に合わせて、リキッドを調整します。
  4. その結果、正しい推奨事項を引き出します。

``` {% connected_content YOUR-API-URL :save items %}

{% assign recommended_item_ids_from_user_profile = custom_attribute.${RECOMMENDED_ITEM_IDS} split: ‘;’ %}

{% for item_id in recommended_item_ids_from_user_profile %} {% assign recommended_item = items | where: “ITEM_ID”, ITEM_ID | first %} recommended_item.item_name {% endfor %} ```

属性 置換
YOUR-API-URL API の実際のURL で置き換えます。
RECOMMENDED_ITEM_IDS 推奨アイテムのID を含むカスタム属性の実際の名前で置き換えます。この属性は、セミコロンで区切られたID の文字列であることが期待されます。
ITEM_ID 項目ID に対応するAPI レスポンスの属性の実際の名前で置き換えます。

接続コンテンツのユースケース

Zomato Restaurants データベースからレストランの推奨を引き出し、その結果をrestaurants というローカル変数として保存するとします。次の接続コンテンツコールを発信できます。

```liquid

{% connected_content https://developers.zomato.com/api/v2.1/search?entity_id={{city_id}}&entity_type=city&count=20&cuisines={{food_type}}&sort=rating:headers{“user-key”:“USER_KEY”} :save restaurants %}

{{city_food.restaurants[0]}} ```

次に、ユーザーの都市と食べ物のタイプに基づいてレストランのおすすめを引きたいとしましょう。これを行うには、コールの先頭にユーザの市区町村およびフードタイプのカスタム属性を動的に挿入し、restaurants の値を変数city_food.restaurants に割り当てます。

接続されたコンテンツコールは次のようになります。

```liquid {% assign city_id = {{custom_attribute.${city_id} | default:‘306’}} %} {% assign food_type = {{custom_attribute.${food_type} | default:‘471’}} %}

{%- connected_content https://developers.zomato.com/api/v2.1/search?entity_id={{city_id}}&entity_type=city&count=20&cuisines={{food_type}}&sort=rating:headers{“user-key”:“USER_KEY”} :save restaurants %}

{% assign restaurants = city_food.restaurants %}

{{city_food.restaurants[0]}} ```

レストランの名前と評価のみを取得するように応答を調整する場合は、以下のように、コールの最後にフィルタを追加できます。

```liquid {% assign city_id = {{custom_attribute.${city_id} | default:‘306’}} %} {% assign food_type = {{custom_attribute.${food_type} | default:‘471’}} %}

{%- connected_content https://developers.zomato.com/api/v2.1/search?entity_id={{city_id}}&entity_type=city&count=20&cuisines={{food_type}}&sort=rating:headers{“user-key”:”USER_KEY”} :save restaurants %} {% assign restaurants = city_food.restaurants %}

{{city_food.restaurants[0].restaurant.name}} {{city_food.restaurants[0].restaurant.user_rating.rating_text}} ```

最後に、レストランのおすすめを評価別にグループ化したいとしましょう。次の手順を実行します。

  1. assign を使用して、”excellent”、”very good”、および”good” のカテゴリを評価するための空白配列を作成します。
  2. リスト内の各レストランの評価を調べるfor ループを追加します。
    • 評価が”Excellent” の場合は、excellent_restaurants 文字列にレストラン名を追加し、最後に* 文字を追加して各レストラン名を区切ります。
    • 評価が「Very Good」の場合は、very_good_restaurants 文字列にレストラン名を追加し、最後に* 文字を追加します。
    • 評価が”Good” の場合は、good_restaurants 文字列にレストラン名を追加し、最後に* を追加します。
  3. レストランのおすすめの返却数は、カテゴリごとに4つに制限してください。

最後の呼び出しは次のようになります。

```liquid {% assign city_id = {{custom_attribute.${city_id} | default:‘306’}} %} {% assign food_type = {{custom_attribute.${food_type} | default:‘471’}} %} {%- connected_content https://developers.zomato.com/api/v2.1/search?entity_id={{city_id}}&entity_type=city&count=20&cuisines={{food_type}}&sort=rating:headers{“user-key”:”USER_KEY”} :save restaurants %} {% assign restaurants = city_food.restaurants %} {% assign excellent_restaurants = “” %} {% assign very_good_resturants = “” %} {% assign good_restaurants = “” %} {% for list in restaurants %} {% if {{list.restaurant.user_rating.rating_text}} == Excellent %} {% assign excellent_restaurants = excellent_restaurants | append: list.restaurant.name | append: * %} {% elseif {{list.restaurant.user_rating.rating_text}} == Very Good %} {% assign very_good_restaurants = very_good_restaurants | append: list.restaurant.name | append: * %} {% elseif {{list.restaurant.user_rating.rating_text}} == Good %} {% assign good_restaurants = good_restaurants | append: list.restaurant.name | append: * %} {% endif %} {% endfor %} {% assign excellent_array = excellent_restaurants | split: * %} {% assign very_good_array = very_good_restaurants | split: * %} {% assign good_array = good_restaurants | split: * %}

すばらしい場所 {% for list in excellent_array %}

{{list}} {% assign total_count = total_count | plus:1 %} {% if total_count >= 4 %} {% break %} {% endif %} {% endfor %}

とても良い場所 {% for list in very_good_array %}

{{list}} {% assign total_count = total_count | plus:1 %} {% if total_count >= 4 %} {% break %} {% endif %} {% endfor %}

良い場所 {% for list in good_array %}

{{list}} {% assign total_count = total_count | plus:1 %} {% if total_count >= 4 %} {% break %} {% endif %} {% endfor %} ```

ユーザーのデバイスに応答がどのように表示されるかの例については、以下のスクリーンショットを参照してください。

考慮事項

使用可能なリソースおよびユースケースに適した推奨エンジンを決定する場合は、次の考慮事項の表を参照してください。

考慮事項 Liquid Catalogs CSV Catalogs API 接続コンテンツ  
データポイントを消費しない サポートされない サポートされる      
No code solution Not supported 事前に生成された液体の場合はSupported Not supported Not supported  
頻繁に必要な高度な液体 サポート サポートされない サポートされない サポートされない サポートされる
製品フィードのデータへの更新 サポートなし 推奨が頻繁に更新されない場合はサポート 推奨が1 時間ごとに更新され、推奨がリアルタイムに更新される場合はサポート    
Braze UI で推奨事項を生成 Supported Supported Supported Braze の外部で生成された場合、サポートなし  
ホストなし、管理、トラブルシューティングの推奨データ Supported Supported Supported 非サポート  
「このページはどの程度役に立ちましたか?」
New Stuff!