パーソナライゼーションのユースケース:買い物かごの放棄メール personalization-use-case-helper-functions

このページ: Adobe Journey Optimizer の upperCase、each、if ヘルパー関数を使用してメール本文をパーソナライズする、買い物かごの放棄のユースケースについて説明します。

この例では、メールメッセージの本文をパーソナライズします。 このメッセージは、買い物かごに商品が残っているが購入を完了していない顧客をターゲットにします。

次のタイプのヘルパー関数を使用します。

  • upperCase 文字列関数:顧客の名を大文字で挿入します。 学習を増やす。
  • each ヘルパー:買い物かごに入っている商品をリストします。 学習を増やす。
  • ifヘルパー:関連製品が買い物かごに入っている場合に製品固有のメモを挿入します。 学習を増やす。

➡️ ヘルパー関数の使用方法について詳しくは、このビデオを参照してください。

開始する前に、次の要素の設定方法を理解しておく必要があります。

次の手順に従います。

手順 1:最初のイベントと関連ジャーニーの作成 create-context

買い物かごの内容は、ジャーニーからのコンテキスト情報です。 したがって、買い物かご固有の情報をメールに追加する前に、最初のイベントとメールをジャーニーに追加する必要があります。

  1. スキーマに productListItems 配列が含まれるイベントを作成します。

  2. この配列のすべてのフィールドを、このイベントのペイロードフィールドとして定義します。

    製品リスト項目データタイプについて詳しくは、Adobe Experience Platform ドキュメントを参照してください。

  3. このイベントで開始されるジャーニーを作成します。

  4. ジャーニーに​ メール ​アクティビティを追加します。

    フロー内のイベントとメールアクティビティを含むジャーニーキャンバス

手順 2: メールの作成 configure-email

  1. メール​アクティビティで、「コンテンツを編集」をクリックしたあと、「E メールデザイナー」をクリックします。

    「コンテンツを編集」と E メールデザイナーオプションを含むメールアクティビティ

  2. E メールデザイナーホームページの左側のパレットから、3 つの構造コンポーネントをメッセージの本文にドラッグ&ドロップします。

  3. HTML コンテンツコンポーネントを、それぞれの新規構造コンポーネントにドラッグ&ドロップします。

    3 つの構造コンポーネントと HTML コンテンツコンポーネントを本文に含む E メールデザイナー

手順 3: 顧客の名(大文字)の挿入 uppercase-function

  1. E メールデザイナーのホームページで、顧客の名を追加する HTML コンポーネントをクリックします。

  2. コンテキストツールバーで、「ソースコードを表示」をクリックします。

    「ソースコードを表示」オプションを含むコンテキストツールバー

  3. HTML を編集​ウィンドウで、upperCase 文字列関数を追加します。

    1. 左側のメニューで、「ヘルパー関数」を選択します。

    2. 検索フィールドを使用して、「uppercase」を検索します。

    3. 検索結果から、upperCase 関数を追加します。 それには、{%= upperCase(string) %}: string の横のプラス記号(+)をクリックします。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {%= upperCase(string) %}
      

      ヘルパー関数で選択された upperCase 関数を含む式エディター

  4. 式から「string」プレースホルダーを削除します。

  5. 名トークンを追加します。

    1. 左側のメニューで、「プロファイル属性」を選択します。

    2. 人物/姓名​を選択します。

    3. 式に​ 名 ​トークンを追加します。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {%= upperCase(profile.person.name.firstName) %}
      

      プロファイル名トークンを含む upperCase を示す式エディター

      人物名データタイプについて詳しくは、Adobe Experience Platform ドキュメントを参照してください。

  6. 「 検証」をクリックしてから、「保存」をクリックします。

    「検証」ボタンと「保存」ボタンを含む HTML を編集ウィンドウ

  7. メッセージを保存します。

手順 4:買い物かご内の商品リストの挿入 each-helper

この手順では、イベントデータの反復処理を示します。 様々なデータソース(イベント、カスタムアクション応答、その他のコンテキストデータ)を反復処理する包括的な例について詳しくは、Handlebars を使用したコンテキストデータの反復処理を参照してください。

  1. メッセージコンテンツを再度開きます。

  2. E メールデザイナーのホームページで、買い物かごの内容を一覧表示する HTML コンポーネントをクリックします。

  3. コンテキストツールバーで、「ソースコードを表示」をクリックします。

    「ソースコードを表示」オプションを含むコンテキストツールバー

  4. HTML を編集​ウィンドウで、each ヘルパーを追加します。

    1. 左側のメニューで、「ヘルパー関数」を選択します。

    2. 検索フィールドを使用して、「each」を検索します。

    3. 検索結果から、each ヘルパーを追加します。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {{#each someArray as |variable|}} {{/each}}
      

      each ヘルパーテンプレートを含む式エディター

  5. 式に productListItems 配列を追加します。

    1. 式から「someArray」プレースホルダーを削除します。

    2. 左側のメニューで、「コンテキスト属性」を選択します。

      コンテキスト属性​は、ジャーニーコンテキストがメッセージに渡された後でのみ使用できます。

    3. Journey Optimizer/イベント/event_name を選択し、productListItems ノードを展開します。

      この例では、event_name はイベントの名前を表します。

    4. 式に​ 製品 ​トークンを追加します。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {{#each context.journey.events.event_ID.productListItems.product as |variable|}} {{/each}}
      

      この例では、event_ID はイベントの ID を表します。

      コンテキスト属性に productListItems を含む式エディター

    5. 式を次のように変更します。

      1. 「.product」文字列を削除します。
      2. 「variable」プレースホルダーを「product」に置き換えます。

      次の例は、変更された式を示しています。

      code language-handlebars
      {{#each context.journey.events.event_ID.productListItems as |product|}}
      
  6. 次のコードを、{{#each}} 開始タグと {{/each}} 終了タグの間に貼り付けます。

    code language-html
    <table>
       <tbody>
          <tr>
             <td><b>#name</b></td>
             <td><b>#quantity</b></td>
             <td><b>$#priceTotal</b></td>
          </tr>
       </tbody>
    </table>
    
  7. 商品名、数量および価格のパーソナライゼーショントークンを追加します。

    1. HTML テーブルからプレースホルダー「#name」を削除します。
    2. 前の検索結果から、名前​トークンを式に追加します。

    次の手順を 2 回繰り返します。

    • プレースホルダー「#quantity」を​ 数量 ​トークンに置き換えます。
    • プレースホルダー「#priceTotal」を​ 合計価格 ​トークンに置き換えます。

    次の例は、変更された式を示しています。

    code language-handlebars
    {{#each context.journey.events.event_ID.productListItems as |product|}}
       <table>
          <tbody>
             <tr>
             <td><b>{{product.name}}</b></td>
             <td><b>{{product.quantity}}</b></td>
             <td><b>${{product.priceTotal}}</b></td>
             </tr>
          </tbody>
       </table>
    {{/each}}
    
  8. 「検証」をクリックしてから、「保存」をクリックします。

    each ブロックを設定した後に「検証」と「保存」を含む式エディター

手順 5:製品固有のメモの挿入 if-helper

  1. E メールデザイナーのホームページで、メモを挿入する HTML コンポーネントをクリックします。

  2. コンテキストツールバーで、「ソースコードを表示」をクリックします。

    「ソースコードを表示」オプションを含むコンテキストツールバー

  3. HTML を編集​ウィンドウで、if ヘルパーを追加します。

    1. 左側のメニューで、「ヘルパー関数」を選択します。

    2. 検索フィールドを使用して、「if」を検索します。

    3. 検索結果から、if ヘルパーを追加します。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {%#if condition1%} render_1
         {%else if condition2%} render_2
         {%else%} default_render
      {%/if%}
      

      if ヘルパーテンプレートを含む式エディター

  4. 式から次の条件を削除します。

    code language-handlebars
    {%else if condition2%} render_2
    

    次の例は、変更された式を示しています。

    code language-handlebars
    {%#if condition1%} render_1
       {%else%} default_render
    {%/if%}
    
  5. 製品名トークンを条件に追加します。

    1. 式から「condition1」プレースホルダーを削除します。

    2. 左側のメニューで、「コンテキスト属性」を選択します。

    3. Journey Orchestration/イベント/event_name を選択し、productListItems ノードを展開します。

      この例では、event_name はイベントの名前を表します。

    4. 式に​ 名前 ​トークンを追加します。

      式エディターには、次の式が表示されます。

      code language-handlebars
      {%#if context.journey.events.`event_ID`.productListItems.name%}
         render_1
         {%else%} default_render
      {%/if%}
      

      if 条件に productListItems 名トークンを含む式エディター

  6. 式を次のように変更します。

    1. 式エディターで、name トークンの後に製品名を指定します。

      次の構文を使用します。ここで、product_name は製品の名前を表します。

      code language-javascript
      = "product_name"
      

      この例では、製品名は「Juno Jacket」です。

      code language-handlebars
      {%#if context.journey.events.`event_ID`.productListItems.name = "Juno Jacket" %}
         render_1
         {%else%} default_render
      {%/if%}
      
    2. 「render_1」プレースホルダーを注記のテキストに置き換えます。

      例:

      code language-handlebars
      {%#if context.journey.events.`event_ID`.productListItems.name = "Juno Jacket" %}
         Due to longer than usual lead times on the Juno Jacket, please expect item to ship two weeks after purchase.
         {%else%} default_render
      {%/if%}
      
    3. 式から「default_render」プレースホルダーを削除します。

  7. 「 検証」をクリックしてから、「保存」をクリックします。

    if ブロックを設定した後に「検証」と「保存」を含む HTML を編集ウィンドウ

  8. メッセージを保存します。

手順 6:ジャーニーのテストと公開 test-and-publish

  1. 「テスト」切替スイッチをオンにしてから、「イベントをトリガー」をクリックします。

    オンにした「テスト」切替スイッチと「イベントをトリガー」ボタンを含むジャーニー

  2. イベント設定​ウィンドウで、入力値を入力し、「送信」をクリックします。

    テストモードは、テストプロファイルでのみ機能します。

    入力値と「送信」ボタンを含むイベント設定ウィンドウ

    メールがテストプロファイルのアドレスに送信されます。

    この例では、Juno Jacket に関するメモがメールに含まれています。これは、この製品が買い物かごに入っているからです。

    メッセージ本文に Juno Jacket の発送メモを示すサンプルメール

  3. エラーがないことを確認し、ジャーニーを公開します。

Handlebars 関数 handlebars

ユースケース use-case

チュートリアルビデオ video

ヘルパー関数の使用方法を説明します。

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This use case shows how to personalize the body of a cart abandonment email in a journey with the upperCase string function, the each helper and the if helper.

Intents:

  • Personalize the body of an email message that targets customers who have left items in their shopping cart but have not completed their purchase.
  • Insert the customer’s first name in capital letters with the upperCase string function and the First name token of the Profile attributes.
  • List the items that are in the cart with the each helper and the productListItems array of the journey event.
  • Insert a product-specific note with the if helper when the related product is in the cart.
  • Test the journey with the Test toggle and Trigger an event, verify that there is no error, then publish the journey.

Glossary:

  • Cart content: Contextual information from the journey, used in this use case to list the items in the cart and to insert a product-specific note. (product-specific)
  • upperCase string function: The function used in this use case to insert the customer’s first name in capital letters. (product-specific)
  • each helper: The helper used in this use case to list the items that are in the cart. (product-specific)
  • if helper: The helper used in this use case to insert a product-specific note if the related product is in the cart. (product-specific)
  • event_name and event_ID: In the examples of this use case, event_name represents the name of your event and event_ID represents the ID of your event.

Guardrails:

  • Contextual attributes are available only after the journey context has been passed to the message.
  • The test mode works only with test profiles.

Prerequisites and permissions:

  • Before you start, ensure you know how to configure a unitary event, a journey that starts with an event, an email message in your journey and the body of an email.
  • You must add an initial event and the email to a journey before you can add cart-specific information to the email.

Terminology:

  • Canonical name: Adobe Journey Optimizer — Acronym: AJO — variants: Journey Optimizer
  • Canonical name: Adobe Experience Platform — Acronym: AEP

FAQ:

  • Why must the event and the email be added to a journey before adding cart-specific information? The cart content is contextual information from the journey.
  • When are Contextual attributes available in the Edit HTML window? Contextual attributes are available only after the journey context has been passed to the message.
  • How do you specify the product in the if condition? In the Expression editor, specify the product name after the name token with the syntax = "product_name", where product_name represents the name of your product.
  • Which profiles does the test mode work with? The test mode works only with test profiles, and the email is sent to the address of the test profile.
  • What do event_name and event_ID represent in the expressions? event_name represents the name of your event and event_ID represents the ID of your event.

Examples:

  • First name in capital letters: {%= upperCase(profile.person.name.firstName) %}.
  • List of cart items: {{#each context.journey.events.event_ID.productListItems as |product|}} wraps an HTML table with the tokens {{product.name}}, {{product.quantity}} and ${{product.priceTotal}}, closed by {{/each}}.
  • Product-specific note, where the product name is “Juno Jacket”: {%#if context.journey.events.`event_ID`.productListItems.name = "Juno Jacket" %} followed by the note “Due to longer than usual lead times on the Juno Jacket, please expect item to ship two weeks after purchase.” and {%/if%}. In the test, the email contains the note about the Juno Jacket because this product is in the cart.

Related pages:

Personas:

  • developer: Can create an event whose schema includes the productListItems array and define all the fields from this array as payload fields. Can insert the customer’s first name in capital letters with {%= upperCase(profile.person.name.firstName) %}. Can list the cart items with {{#each context.journey.events.event_ID.productListItems as |product|}} and the {{product.name}}, {{product.quantity}} and {{product.priceTotal}} tokens. Can insert a product-specific note with the if helper and the syntax = "product_name" after the name token. The page states that Contextual attributes are available only after the journey context has been passed to the message. Where: “Examples”.

Onboarding:

  • Level: Intermediate
  • First minimal step: Create an event whose schema includes the productListItems array.
  • Success check: The email is sent to the address of the test profile.
recommendation-more-help
journey-optimizer-help