ドキュメントTarget デベロッパーガイド

adobe.target.sendNotifications(options)

最終更新日: 2024年7月22日
  • トピック:

作成対象:

  • 開発者

この関数は、adobe.target.applyOffer() または adobe.target.applyOffers() を使用せずにエクスペリエンス Target レンダリングされたときにエッジに通知を送信します。

メモ
この関数は、at.js 2.1.0 で導入され、2.1.0 以上の任意のバージョンで使用できます。
キータイプ必須?説明
consumerId文字列×指定しない場合、デフォルト値はクライアントのグローバル mbox です。このキーは、A4T 統合に使用される補助的なデータ ID を生成するために使用されます。
リクエストオブジェクト○下の「リクエスト」の表を参照してください。
timeout数値×リクエストのタイムアウト。指定しない場合、at.js のデフォルトのタイムアウトが使用されます。

リクエスト

フィールド名タイプ必須?制限事項説明
Request > notificationsオブジェクトの配列○表示されるコンテンツに対する通知、クリックされたセクター、訪問されたビューまたは mbox。
Request > notifications > addressオブジェクト×
Request > notifications > address > url文字列×通知の送信元の URL。
Request > notifications > address > referringUrl文字列×通知の送信元のリファラル URL。
Request > notifications > parameters文字列×

以下の名前はパラメーターに使用できません。

  • orderId
  • orderTotal
  • productPurchasedIds

次の点に留意してください。

  • 最大 50 パラメーターの制限。
  • パラメーター名は空にできない。
  • パラメーター名の最大長は 128。
  • パラメーター名は「profile」で始めることはできない。
  • パラメーター値最大長は 5000。
Request > notifications > profileParameters文字列×

以下の名前はパラメーターに使用できません。

  • orderId
  • orderTotal
  • productPurchasedIds

次の点に留意してください。

  • 最大 50 パラメーターの制限。
  • パラメーター名は空にできない。
  • パラメーター名の最大長は 128。
  • パラメーター名は「profile」で始めることはできない。
  • パラメーター値最大長は 5000。
Request > notifications > orderオブジェクト×注文の詳細を説明するオブジェクト。

Request > notifications > order

id

文字列×<= 250 文字。注文 ID。

Request > notifications > order

total

文字列×>= 0合計注文額。

Request > notifications > order

purchasedProductIds

文字列の配列×
  • 空の値は許可されない。
  • 各製品 ID の最大長は 50。
  • (コンマ区切りで連結された)製品 ID の合計の長さは 250 以内。
注文製品 ID。
Request > notifications > productオブジェクト×
Request > notifications > product > id文字列×<= 128 文字。空にできない。製品 ID。
Request > notifications > product > categoryId文字列×<= 128 文字。空にできない。カテゴリ ID.
Request > notifications > id文字列○<= 200 文字。通知 ID は応答で返され、通知が正常に処理されたことを示す。
Request > notifications > impressionId文字列×<= 128 文字。インプレッション ID が、現在の通知を以前の通知とスティッチ(リンク)したり、リクエストを実行したりするのに使用される。それらの両方が一致する場合、2 番目以降のクエストはアクティビティまたはエクスペリエンスに新しいインプレッションを生成しません。
Request > notifications > type文字列○「クリック」または「ディスプレイ」がサポートされています。通知タイプ。
Request > notifications > timestamp数値 <int64>○UNIX エポックから経過したミリ秒で示す通知のタイムスタンプ。
Request > notifications > tokens文字列の配列○通知のタイプに基づく、表示されたコンテンツまたはクリックされたセクターのトークンのリスト。
Request > notifications > mboxオブジェクト×mbox の通知。

Request > notifications > mbox

name

文字列×

空の値は許可されない。

許可される文字:この表の後のメモを参照してください。

mbox 名。

Request > notifications > mbox

state

文字列×mbox 状態トークン。
Request > notifications > viewオブジェクト×

Request > notifications > view

id

整数 <int64>×ビュー ID。ビューがビュー API で作成された際にビューに割り当てられた ID。

Request > notifications > view

name

文字列×<= 128 文字。ビューの名前。

Request > notifications > view

key

文字列×<= 512 文字。ビューキー。API でビューに設定されたキー。

Request > notifications > view

state

文字列×ビュー状態トークン。

注意:次の文字は Request > notifications > mbox > name では使用できません 使用できません。

- '-, ./=`:;&!@#$%^&*()+|?~[]{}'

プリフェッチされた mbox のレンダリング後の sendNotifications() 呼び出し

function createTokens(options) {
  return options.map(e => e.eventToken);
}

function createNotification(mbox, type, tokens) {
  const id = 11111; // here we should use a random ID like UUID
  const timestamp = Date.now();
  const { name, state, parameters, profileParameters, order, product } = mbox;
  const result = {
    id,
    type,
    timestamp,
    parameters,
    profileParameters,
    order,
    product
  };

  result.mbox = { name, state };
  result.tokens = tokens;

  return result;
}

adobe.target.getOffers({
  request: {
    prefetch: {
      mboxes: [
        {
          index: 0,
          name: "a1-serverside-ab"
        }
      ]
    }
  }
})
.then(response => {
  const mboxes = response.prefetch.mboxes;
  const notifications = mboxes.map(mbox => {
    const type = "display";
    const tokens = createTokens(mbox.options);

    return createNotification(mbox, type, tokens);
  });

  adobe.target.sendNotifications({
    request: { notifications }
  });
})
NOTE
Adobe Analytics、getOffers() を prefetch のみおよび sendNotifications() と共に使用している場合は、sendNotifications() の実行後に Analytics リクエストを実行する必要があります。 この目的は、sendNotifications() によって生成された SDID が、Analytics と Target に送信された SDID と一致することを確認することです。
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3