※この記事は英語版を翻訳しており、一部機械翻訳を含むため内容は後日更新される可能性があります。最新の内容は英語版を参照してください。表示言語は画面左下の言語名から切り替えられます。
Marketing Cloud(マーケティング・クラウド) で動的コンテンツを表示するステップと例です。
注: この情報は、Content Builder(コンテンツ・ビルダー)によって生成されたコンテンツには適用されません。
次の手順を実行します。
1.テンプレートメールに次のコードを入れます (これにより、アカウントレベルのヘッダーとフッターを使用できるようになります)。
%%[
Var @Content_A,@Content_B,@Content_C
Set @Content_A = Test_A
Set @Content_B = Test_B
Set @Content_C = Test_C
]%%
%%[IF @Content_A == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_A")=%%
%%[ELSEIF @Content_B == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_B")=%%
%%[ELSEIF @Content_C == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_C")=%%
%%[ELSE]%%
No content to render.... this would be a subscriber who meets none of the previous criteria..this would be the default content if you wanted to have default content
%%[ENDIF]%%
2.「My Contents」フォルダに 3 つの ContentAreas (Content_A、Content_B、および Content_C) を作成します。
注: ContentArea のフルパスは、ContentAreaByName() 関数で指定するため、「my contents\dynamic\Content_C」は、「My Contents」の下の「Dynamic」サブフォルダの下の Content_C です。HTML 内のコンテンツはシンプルにしてください (<H1>これはコンテンツ領域 A です</H1>)。これにより、基本的なコンテンツで関数をテストできます。
3.リストを作成し、上記のコードの各条件に対する値だけを持つ購読者を追加します。メール、ContentAreas、およびリストが用意できたら、テストリストでメールの送信プレビューを実行し、各購読者をプレビューしながら動的コンテンツの変更を確認できます。
注: IF THEN ELSEIF の使用に基づいて、表示される ContentArea は属性に「Yes」の値が含まれる最初のものになります。
%%[ Var @Content_A,@Content_B,@Content_C Set @Content_A = Test_A Set @Content_B = Test_B Set @Content_C = Test_C ]%%
属性 Test_A、Test_B、および Test_C の値を格納する変数を作成し、それらに対応する属性値を設定します。「Set @Content_A = Test_A」は、変数 @Content_A に Test_A の値を設定することを意味します。 このタイプの AMPscript の詳細については、AMPScript 101 ドキュメントを参照してください。
これは変数内の値を調べて、ContentAreaByName 関数を使用して ContentArea を挿入する IF ロジックです。現在、値が指定した範囲外になると、ELSE ブロックの情報が挿入されます。このロジックは微調整できます。
%%[IF @Content_A == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_A")=%%
%%[ELSEIF @Content_B == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_B")=%%
%%[ELSEIF @Content_C == 'Yes' THEN]%%
%%=ContentAreaByName("my contents\dynamic\Content_C")=%%
%%[ELSE]%%
No content to render.... this would be a subscriber who meets none of the previous criteria
%%[ENDIF]%%000386274

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.