ルールに基づく項目のレコメンデーションの作成
カタログ内のアイテムからルールベースのレコメンドエンジンを作成する方法について説明します。
ルールベースの項目の推奨事項について
ルールベースのレコメンデーションエンジンは、ユーザーデータと商品情報を使って、メッセージング内でユーザーに関連アイテムを提案する。これは、Liquidを使用し、Braze catalogsまたはConnected Contentを使用して、ユーザーの動作と属性に基づいてコンテンツを動的にパーソナライズします。
ルールベースの推奨事項は、手動で設定する必要がある固定ロジックに基づいています。つまり、ロジックを更新しない限り、ユーザーの購入履歴や嗜好に合わせてレコメンドが調整されないということだ。
AI によりパーソナライズされたおすすめ (ユーザーの履歴に合わせて自動的に調整される) を作成するには、「AI によるアイテムのおすすめ」を参照してください。
推奨エンジンオプション
どの推奨エンジンが、利用可能なリソースやユースケースに適しているかを判断する際には、この検討事項表を参考にしてください。
レコメンデーションエンジン | データポイントは消費されません | ノーコードソリューション | 高度な Liquid がない | 製品フィードを自動的に更新する | Braze UI で生成 | データホスティングまたはトラブルシューティングなし |
---|---|---|---|---|---|---|
カタログCSV | ✔ | はい (事前に生成されtげいる Liquid を使用する場合) | ✔ | はい (レコメンデ―ションが頻繁に更新されない場合) | ✔ | ✔ |
カタログ API | ✔ | ✔ | はい (レコメンデーションが1時間ごとに更新される場合) | ✔ | ✔ | |
コネクテッドコンテンツ | ✔ | ✔ (レコメンデーションはリアルタイムで更新される) |
はい (Braze の外部で生成された場合) | |||
Liquid | ✔ | ✔ |
推奨エンジンの作成
カタログまたは接続コンテンツのいずれかを使用して、推奨エンジンを作成します。
カタログを使用してレコメンドエンジンを作成するには
- 製品のカタログを作成します。
- 製品ごとに、推奨製品のリストを区切り記号 (パイプ
|
のようなもの) で区切った文字列として、「product_recommendations 」という名前の列に追加します。 - カタログにおすすめを探したい製品IDを渡す。
- そのカタログアイテムの
product_recommendations
値を取得し、Liquid の分割フィルターを使用して区切り記号で区切ります。 - それらの 1 つ以上の ID をカタログに渡して、他の製品の詳細を収集します。
例
例えば、あなたが健康食品のアプリを持っていて、ユーザーがアプリに登録した期間に応じて異なるレシピを送るコンテンツカードキャンペーンを作りたいとしよう。まず、以下の情報を含むCSV ファイルを使用してカタログを作成してアップロードします。
フィールド | 説明 |
---|---|
id | ユーザーがアプリに登録してからの日数に関連する一意の数字。例えば、3 は3日間に相当する。 |
タイプ | comfort 、fresh などのレシピカテゴリーがあります。 |
名称 | 各 ID に送信されるコンテンツカードのタイトル。「今週のランチ用の作り置き」や「タコスについて話そう」などです。 |
リンク | レシピ記事へのリンク。 |
image_url | レシピに対応する画像, 写真。 |
カタログが Braze にアップロードされた後、カタログアイテムの一部のプレビューを確認して、情報が正確にインポートされたことを確認してください。プレビューでは項目がランダムになっているかもしれないが、レコメンデーションエンジンの出力には影響しない。
コンテンツカードキャンペーンを作成する。作成画面で、キャンペーンの送信先のユーザー、および表示するレシピと画像を決定する Liquid ロジックを入力します。このユースケースで、Braze はユーザーの start_date
(または登録日) を取得し、現在の日付と比較します。日数の違いによって、送信されるコンテンツカードが決まります。
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
{% 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 }}
以下に例を示します。
On click behaviorセクションで、iOS、Android、Webデバイスでユーザーがコンテンツカードをクリックしたときに、どこにリダイレクトされるべきかのLiquidロジックを入力する。
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 }}
以下に例を示します。
テスト」タブに移動し、「ユーザーとしてメッセージをプレビュー」で「カスタムユーザー」を選択する。カスタム属性フィールドに日付を入力し、その日にサインアップしたユーザーに送信されるコンテンツカードをプレビューする。
という名前のカスタム属性の例
Connected Content を使用してレコメンドエンジンを作成するには、まず次のいずれかの方法を使用して新しいエンドポイントを作成します。
オプション | 説明 |
---|---|
スプレッドシートの変換 | スプレッドシートをSheetDP のようなサービスを使用してJSON API エンドポイントに変換し、この生成されるAPI URL に注意してください。 |
カスタムエンドポイントの作成 | カスタムビルドの社内エンドポイントを作成し、ホストおよびメンテナンスを行います。 |
サードパーティエンジンの使用 | サードパーティの推奨エンジン(Alloy partnersなど)を使用します。これには、Amazon Personalise、Certona、Dynamic Yieldなどが含まれます。 |
次に、エンドポイントを呼び出すメッセージで Liquid を使用して、カスタム属性値をユーザーのプロファイルに一致させ、対応する推奨事項をプルします。
1
2
3
4
5
6
7
8
{% 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 応答の実際の属性名に置き換えます。 |
これは基本的な例であり、特定のニーズやデータ構造に基づいてさらに修正する必要があるかもしれない。詳細なガイダンスについては、Liquid のドキュメントを参照するか、開発者に相談してください。
例
例えば、Zomato Restaurantsデータベースからお勧めのレストランを取得し、その結果をrestaurants
という内部変数として保存したいとしよう。次のコネクテッドコンテンツの呼び出しができます。
1
2
3
4
{% 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
に代入することで、これを行うことができます。
コネクテッドコンテンツの呼び出しは次のようになります。
1
2
3
4
5
6
7
8
{% 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]}}
レストラン名と評価だけを取得するようにレスポンスを調整したい場合は、次のようにフィルターを呼び出しの最後に追加することができる:
1
2
3
4
5
6
7
8
{% 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}}
最後に、お勧めのレストランを評価別にまとめたいとしよう。次の手順を実行します。
assign
、「素晴らしい」、「非常に良い」、「良い」の評価カテゴリー用の空白の配列を作成する。- リスト内の各レストランの評価を調べる
for
ループを追加します。- 評価が「優れている」場合は、レストラン名を
excellent_restaurants
文字列の後に追加し、各レストラン名を区切る * 文字を最後に追加します。 - 評価が “Very Good “の場合、
very_good_restaurants
の文字列にレストラン名を追加し、最後に*を追加する。 - 評価が “Good “の場合、
good_restaurants
の文字列にレストラン名を追加し、最後に*を追加する。
- 評価が「優れている」場合は、レストラン名を
- 返されるおすすめレストランの数を各カテゴリで 4 店に制限します。
最終的な呼び出しは次のようになります。
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{% 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: `*` %}
Excellent places
{% for list in excellent_array %}
{{list}}
{% assign total_count = total_count | plus:1 %}
{% if total_count >= 4 %}
{% break %}
{% endif %}
{% endfor %}
Very good places
{% for list in very_good_array %}
{{list}}
{% assign total_count = total_count | plus:1 %}
{% if total_count >= 4 %}
{% break %}
{% endif %}
{% endfor %}
Good places
{% for list in good_array %}
{{list}}
{% assign total_count = total_count | plus:1 %}
{% if total_count >= 4 %}
{% break %}
{% endif %}
{% endfor %}
ユーザー端末でのレスポンシブの表示例については、以下のスクリーンショットを参照のこと。