このページでは、式フラグメントをパーソナライゼーションエディターに挿入して再利用する方法、暗黙的な変数を操作する方法、ループ内でフラグメントを使用する方法、編集可能なフィールドをカスタマイズする方法、Adobe Journey Optimizerでの継承を解除する方法について説明します。
パーソナライゼーションエディターを使用すると、現在のサンドボックスに作成または保存されたすべての式フラグメントを活用できます。
フラグメントは、Journey Optimizer キャンペーンおよびジャーニー全体で参照できる、再利用可能なコンポーネントです。 この機能を使用すると、複数のカスタムコンテンツブロックを事前に構築し、マーケティングユーザーはそのコンテンツブロックを使用して、改善されたデザインプロセスでコンテンツを迅速に組み立てることができます。 詳しくは、フラグメントを参照してください。
➡️ フラグメントの管理、作成、使用方法について詳しくは、このビデオを参照してください。
式フラグメントの使用 use-expression-fragment
コンテンツに式フラグメントを追加するには、次の手順に従います。
-
パーソナライゼーションエディターを開き、左側のパネルで「フラグメント」ボタンを選択します。
リストには、現在のサンドボックスで作成またはフラグメントとして保存されたすべての式フラグメントが表示されます。 フラグメントの作成方法を学ぶ
作成日で並べ替えられます。最近追加された式フラグメントは、リストの最初に表示されます。
また、このリストを更新することもできます。
note NOTE コンテンツの編集中に一部のフラグメントが変更または追加された場合、リストは最新の変更内容に更新されます。 -
コンテンツ内の目的の場所にカーソルを置き、式フラグメントの横にある「+」アイコンをクリックして、対応するフラグメント IDをエディターに挿入します。
note NOTE 式フラグメントは、電子メールまたはコンテンツテンプレートの <head>セクションに追加することもできます。
note caution CAUTION 任意の ドラフト または ライブ フラグメントをコンテンツに追加できます。 ただし、ジャーニーまたはキャンペーンで ドラフト ステータスのフラグメントを使用している場合、そのジャーニーまたはキャンペーンはアクティブ化できません。 ジャーニーまたはキャンペーンの公開時に、ドラフトフラグメントにエラーが表示されるので、公開するには承認する必要があります。 -
フラグメント ID を追加したら、対応する式フラグメントを開いてインターフェイスから編集すると、変更が同期されます。 これらは、そのフラグメント ID を含むすべてのドラフトまたはライブジャーニー/キャンペーンに自動的に生成されます。
-
フラグメントの横にある「その他のアクション」ボタンをクリックします。 開いたコンテキストメニューから「フラグメントを表示」を選択すると、そのフラグメントに関する詳細情報が表示されます。 また、フラグメント ID も表示され、ここからコピーできます。
-
コンテキストメニューの「フラグメントを開く」オプションを使用するか、フラグメント情報パネルから式フラグメントを別のウィンドウで開き、そのコンテンツとプロパティを編集できます。 詳しくは、フラグメントの編集方法を参照してください
-
その後、パーソナライゼーションエディターのパーソナライズ機能とオーサリング機能をすべて使用して、通常どおりコンテンツをカスタマイズして検証できます。
-
場合によっては、変数の計算のみが必要となり、式フラグメントのコンテンツは非表示にした方がよいこともあります。 これを行うには、
render属性を使用してfalseに設定します。 次に例を示します。code language-none Hi {{profile.person.name.firstName|fragment id='ajo:fragmentId/variantId' mode ='inline' render=false}}
暗黙的変数の使用 implicit-variables
暗黙的変数は、既存のフラグメント機能を強化して、コンテンツの再利用性とスクリプトのユースケースの効率を向上させます。 フラグメントは入力変数を使用し、キャンペーンおよびジャーニーコンテンツで使用できる出力変数を作成できます。
この機能は、例えば、現在のキャンペーンやジャーニーに基づいてメールのトラッキングパラメーターを初期化し、これらのパラメーターをメールコンテンツに追加されたパーソナライズされたリンクに使用できます。
次のようなユースケースが考えられます。
-
フラグメントでの入力変数の使用
フラグメントをキャンペーン/ジャーニーアクションコンテンツで使用すると、フラグメント外で宣言された変数を活用できます。 以下に例を示します。
utm_content変数がキャンペーンコンテンツで宣言されていることがわかります。 ヒーローブロックというフラグメントが使用されると、utm_contentパラメーター値が追加されるリンクが表示されます。 最終結果は、https://luma.enablementadobe.com?utm_campaign= Product_launch&utm_content= start_shoppingです。 -
フラグメントの出力変数の使用
フラグメント内で計算または定義された変数は、コンテンツ内で使用できます。 次の例では、フラグメント F1 によって、一連の変数が宣言されています。
メールコンテンツでは、次のパーソナライズ機能を使用できます。
フラグメント F1 は、変数
utm_campaignおよびutm_contentを初期化します。 次に、メッセージコンテンツ内のリンクに、これらのパラメーターが追加されます。 最終結果は、https://luma.enablementadobe.com?utm_campaign= Product_launch&utm_content= start_shoppingです。
ループ内の式フラグメントの使用 fragments-in-loops
{{#each}} ループ内で式フラグメントを使用する際は、変数範囲の仕組みを理解することが重要です。 式フラグメントは、メッセージコンテンツで定義されているグローバル変数にアクセスできますが、ループ固有の変数をパラメーターとして受け取ることはできません。
サポートされているパターン:グローバル変数の使用 global-variables-in-loops
式フラグメントは、ループ内から呼び出される場合でも、フラグメント外部で定義されているグローバル変数を参照できます。 これは、反復コンテキストでフラグメントを使用する必要がある場合に推奨されるアプローチです。
例:ループ内でグローバル変数を使用したフラグメントの使用
メッセージコンテンツで、グローバル変数を定義し、それを参照するフラグメントを使用します。
式フラグメント(fragment123)では、globalDiscount 変数を参照できます。
このパターンが機能するのは、ループコンテキストに関係なく、フラグメント内を含むメッセージ全体でグローバル変数にアクセスできるからです。
サポートされないパターン:フラグメントパラメーターとしてのループ変数の受け渡し loop-variables-limitations
現在の反復項目(上記の例では product)をパラメーターとして式フラグメントに渡すことはできません。 フラグメントは、周囲の {{#each}} ブロックからループ範囲の変数に直接アクセスできません。
例:機能しない内容
現在の実装ではループ固有の変数に対するパラメーターの受け渡しがサポートされていないので、フラグメントは product をパラメーターとして受け取り、内部で使用できません。
推奨される回避策 fragments-in-loops-workarounds
ループからのデータで式フラグメントを使用する必要がある場合は、次の方法を考慮します。
-
メッセージにロジックを直接含める:ループ固有のロジックにフラグメントを使用する代わりに、
{{#each}}ブロック内にパーソナライゼーションコードを直接追加します。code language-handlebars {{#each context.journey.actions.GetProducts.items as |product|}} <div class="product"> <h3>{{product.name}}</h3> <p>Price: ${{product.price}}</p> {{#if product.price > 100}} <span class="premium-badge">Premium Product</span> {{/if}} </div> {{/each}} -
ループ外でフラグメントを使用:フラグメントコンテンツがループに依存しない場合は、反復ブロックの前または後にフラグメントを呼び出します。
code language-handlebars {{fragment id='ajo:fragment123/variant456' mode='inline'}} {{#each context.journey.actions.GetProducts.items as |product|}} <div class="product"> <h3>{{product.name}}</h3> <p>Price: ${{product.price}}</p> </div> {{/each}} -
複数のグローバル変数を設定:反復をまたいでフラグメントに異なる値を渡す必要がある場合は、各フラグメントの呼び出しの前にグローバル変数を設定します(ただし、これにより柔軟性が制限されます)。
編集可能フィールドのカスタマイズ customize-fields
変数を使用して式フラグメントの特定の部分が編集可能になっている場合は、特定の構文を使用して、それらのデフォルト値を上書きできます。 詳しくは、フラグメントをカスタマイズ可能にする方法を参照してください
フィールドをカスタマイズするには、次の手順に従います。
-
フラグメントメニューからコードにフラグメントを挿入します。
-
構文の最後にある
<fieldId>="<value>"コードを使用して、変数のデフォルト値を上書きします。次の例では、ID が「sports」である変数の値を「yoga」値で上書きしています。 これにより、フラグメントコンテンツで「sport」変数が参照されているすべての箇所に「yoga」が表示されます。
メールの作成時に編集可能なフィールドを式フラグメントに追加し、その値を上書きする方法を示す例について詳しくは、この節を参照してください。
動的フラグメント解決の使用 dynamic-resolution
デザイン時にフラグメント IDを静的に埋め込む代わりに、受信者ごとに実行時にフラグメント IDを動的に解決できます。 これにより、プロファイル属性、データセット参照、コンテキストデータにもとづいて、異なるプロファイルが同じキャンペーンやジャーニー内で完全に異なるコンテンツブロックを受け取ることができます。
継承の解除 break-inheritance
パーソナライゼーションエディターにフラグメント ID を追加すると、元の式フラグメントに行った変更が同期されます。
ただし、式フラグメントのコンテンツをエディターにペーストすることもできます。 コンテキストメニューから「フラグメントをペースト」を選択して、そのコンテンツを挿入します。
その場合、元のフラグメントからの継承は壊れます。 フラグメントのコンテンツはエディターにコピーされ、変更内容は同期されなくなります。
これは、元のフラグメントにリンクされなくなったスタンドアロン要素になります。コード内の他の要素として編集できます。
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 page explains how to insert, customize, and manage expression fragments in the personalization editor — including implicit variables, using fragments inside loops, editable fields, dynamic resolution, and breaking inheritance.
Intents:
- Insert an expression fragment from the Fragments menu and understand automatic change propagation
- Use implicit variables: input variables (declared outside the fragment, used inside) and output variables (declared inside the fragment, used in surrounding message content)
- Use expression fragments inside loops — leverage global variables for fragment access; understand the limitation on passing loop-scoped variables as parameters
- Override editable fields in a customizable fragment using
<fieldId>="<value>"syntax - Resolve fragment IDs dynamically at runtime based on profile attributes, dataset lookups, or context data
- Break inheritance by pasting fragment content directly into the editor
Glossary:
- Expression fragment: A reusable personalization expression component referenced by ID across campaigns and journeys; changes to the fragment propagate automatically to all content referencing it. (product-specific)
- Implicit variables: Variables that extend the fragment functionality — input variables (declared in campaign/journey content, consumed inside the fragment) and output variables (declared inside the fragment, available in the surrounding message content). (product-specific)
- Input variable: A variable declared outside the fragment (in campaign or journey content) that the fragment can reference and use internally.
- Output variable: A variable declared or computed inside a fragment that becomes available for use in the surrounding message content after the fragment is called.
- Editable fields: Fragment variables exposed to allow the inserting user to override default values using
<fieldId>="<value>"syntax, without editing the fragment source. (product-specific) - Dynamic fragment resolution: The ability to resolve a fragment ID at runtime (based on profile attributes, dataset lookups, or context data) rather than embedding a static fragment ID at design time. (product-specific)
- Break inheritance: Using “Paste fragment” from the contextual menu copies the fragment’s content into the editor as a standalone element that no longer synchronizes with the original fragment. (product-specific)
Guardrails:
- Maximum 30 fragments can be added in a given delivery.
- Fragments can only be nested up to 1 level.
- A journey or campaign cannot be activated or published if it contains a fragment with Draft status; draft fragments must be approved before publication.
- Expression fragments cannot receive loop-scoped variables (the current
{{#each}}iteration item) as parameters — this is a known limitation. Use global variables or inline logic as a workaround. - If a fragment containing multiple line breaks is used in SMS or push content, line breaks are preserved; test the content before sending.
Terminology:
- Canonical name: expression fragment — variants: fragment, expression fragment
- Synonyms: “fragment ID” = the identifier used to reference the fragment in expressions
- Do not confuse: inserting a fragment by ID (referenced; changes propagate automatically to all content) ≠ breaking inheritance / paste fragment (content copied into editor; standalone element, no longer linked to original)
- Do not confuse: input variables (declared outside the fragment, consumed inside) ≠ output variables (declared inside the fragment, consumed outside in surrounding message content)
- Do not confuse: Draft fragment (can be added to content but blocks journey/campaign publication until approved) ≠ Live fragment (fully published; safe for active journeys and campaigns)
FAQ:
- Q: How many fragments can be added in a single delivery? — Up to 30 fragments.
- Q: Can fragments be nested inside other fragments? — Yes, but only up to 1 level of nesting.
- Q: What happens if I use a Draft fragment in a journey or campaign? — You can add a Draft fragment to content, but you cannot activate or publish the journey or campaign until the fragment is approved and its status changes to Live.
- Q: Can an expression fragment receive the current loop item (e.g.,
productin{{#each}}) as a parameter? — No. Expression fragments cannot receive loop-scoped variables as parameters. Use global variables declared outside the loop (which the fragment can access), or include the personalization logic directly within the loop instead of using a fragment. - Q: What is breaking inheritance and when should I use it? — Breaking inheritance means using “Paste fragment” from the contextual menu to copy the fragment’s content directly into the editor. The pasted content becomes a standalone element that no longer synchronizes with the original fragment — use this when you need to customize the content beyond what editable fields allow, knowing future changes to the original fragment will not propagate to this copy.