開発者向けガイド developer-customization-guide
このガイドは、Brand Conciergeのデプロイメントを実装またはカスタマイズする開発者向けおよび技術者向けです。 Web SDKとWeb クライアントのインストール、外観とコンテンツのカスタマイズ、コールバック関数を使用したクライアントサイドイベントのリッスン、レポート用の会話データのエクスポートについて説明します。
Web SDKとWeb クライアントのインストール installation
前提条件 prerequisites
- Adobe Experience Platform(AEP)をご利用のお客様。
- このページは、Adobe Experience Platform Web SDKで実装されています。
- ページで使用されるデータストリーム IDは、Brand Conciergeに対して有効になっています。
手順1:Web SDKの挿入 inject-web-sdk
ページの<head> セクションに以下を追加します。
<script>
!(function (n, o) {
o.forEach(function (o) {
n[o] ||
((n.__alloyNS = n.__alloyNS || []).push(o),
(n[o] = function () {
var u = arguments;
return new Promise(function (i, l) {
n[o].q.push([i, l, u]);
});
}),
(n[o].q = []));
});
})(window, ["alloy"]);
</script>
<script src="https://cdn1.adoberesources.net/alloy/2.31.1/alloy.min.js"></script>
手順2:Web クライアントの挿入 inject-web-client
Web SDK スクリプトの後に、<head> セクションに次を追加します。
<script src="https://experience.adobe.net/solutions/experience-platform-brand-concierge-web-agent/static-assets/main.js"></script>
手順3:Web SDKの設定 configure-web-sdk
以下のプレースホルダーの代わりに、組織の独自の値でalloy("configure", ...)を呼び出します。
alloy("configure", {
defaultConsent: "in",
edgeDomain: "edge.adobedc.net",
edgeBasePath: "ee",
datastreamId: "YOUR_DATASTREAM_ID",
orgId: "YOUR_IMS_ORG_ID",
debugEnabled: true,
idMigrationEnabled: false,
thirdPartyCookiesEnabled: false,
prehidingStyle: ".personalization-container { opacity: 0 !important }",
onBeforeEventSend: (options) => {
const x = options.xdm;
const params = new URLSearchParams(window.location.search);
const titleParam = params.get("title");
if (titleParam) {
x.web.webPageDetails.name = titleParam;
} else {
x.web.webPageDetails.name = "default-page";
}
return true;
}
});
alloy("sendEvent", {});
datastreamIdorgIddebugEnabledfalseに設定されます。prehidingStyleonBeforeEventSend手順4:Web クライアントの初期化 initialize-web-client
Web SDKのconfigure呼び出しの後、ブートストラップ APIを呼び出してWeb クライアントを初期化します。
window.adobe.concierge.bootstrap({
instanceName: "alloy",
stylingConfigurations: window.styleConfigurations,
selector: "#brand-concierge-mount"
});
instanceNameselectorビジュアルとコンテンツのカスタマイズ customization
bootstrap()に渡されたstylingConfigurations オブジェクトは、Web クライアント全体の外観、動作、およびテキストを制御します。 いくつかの領域に編成されています。
メタデータ metadata
"metadata": {
"brandName": "Your Brand",
"version": "1.0.0",
"language": "en-US",
"namespace": "brand-concierge"
}
動作 behavior
個々のチャット機能の動作を制御します。
"behavior": {
"input": {
"enableVoiceInput": true
},
"chat": {
"messageAlignment": "left",
"messageWidth": "80%"
},
"privacyNotice": {
"title": "Privacy Notice",
"text": "By using this automated chatbot, you consent that any personal information you provide in the chat may be collected, used, analyzed, disclosed, and retained by Adobe and its service providers, in accordance with the Adobe Privacy Policy. Please do not enter any sensitive personal information (e.g., financial or health data)."
},
"disclaimer": {
"attachWithInput": true
},
"chatTranscript": {
"enabled": true,
"maxSessions": 1,
"maxMessagesPerSession": 20,
"cleanupInterval": 24
},
"meetingForm": {
"fieldsPerRow": 2,
"title": { "text": "Schedule meeting", "alignment": "left" },
"subtitle": { "text": "I'd be happy to help you schedule a meeting! Please fill out the form below, and we'll follow up with a calendar to confirm your day and time.", "alignment": "left" },
"buttons": {
"submit": { "text": "Schedule meeting", "alignment": "left" },
"cancel": { "text": "Cancel", "alignment": "left" }
}
},
"calendarWidget": {
"title": { "text": "Book a meeting", "alignment": "left" },
"subtitle": { "text": "Thanks! Here's a calendar where you can choose a time that works best for your schedule:", "alignment": "left" },
"postTitle": { "text": "Once confirmed, you'll receive a calendar invite with all the details.", "alignment": "left" },
"buttons": {
"confirm": { "text": "Schedule a meeting", "alignment": "left" },
"cancel": { "text": "Cancel", "alignment": "left" }
}
}
}
免責事項 disclaimer
"disclaimer": {
"text": "AI responses may be inaccurate or misleading. Be sure to double check answers and sources."
}
テキスト文字列 text-strings
すべてのユーザー向けコピーは、text オブジェクトを通じて上書きできます。 共通キー:
welcome.heading / welcome.subheadinginput.placeholderinput.messageInput.aria / input.send.aria / input.mic.ariaerror.network / error.generalloading.messagefeedback.dialog.title.positive / .negativefeedback.dialog.question.positive / .negativefeedback.toast.successfeedback.thumbsUp.aria / feedback.thumbsDown.aria配列 arrays
コンテンツの設定可能なリスト:
"arrays": {
"welcome.examples": [
{
"text": "I want to edit and enhance my photos",
"image": "https://example.com/idea-1.png",
"backgroundColor": "#66BFE7"
}
],
"feedback.positive.options": [
"Helpful and relevant recommendations",
"Clear and easy to understand",
"Friendly and conversational tone",
"Visually appealing presentation",
"Other"
],
"feedback.negative.options": [
"Not helpful or relevant",
"Confusing or unclear",
"Too formal or robotic",
"Poor visual presentation",
"Other"
]
}
アセット assets
"assets": {
"icons": {
"company": "<svg>...</svg>"
}
}
テーマ theme
色、フォント、レイアウトを制御するCSS カスタムプロパティ:
"theme": {
"--color-primary": "#1473e6",
"--color-primary-hover": "#0056b3",
"--color-button-primary": "#3B63FB",
"--color-accent": "#9085ED",
"--color-button-submit": "#4759e6",
"--color-button-submit-hover": "#3a4bce",
"--color-message-user": "#1473e6",
"--font-family": "'Adobe Clean', adobe-clean, 'Trebuchet MS', sans-serif",
"--main-container-background": "linear-gradient(135deg, #66ccff, #cc99ff, #ffcc99, #ccff99)",
"--submit-button-fill-color": "white",
"--card-text-background": "var(--color-background)",
"--card-text-border-radius": "var(--border-radius-card)",
"--message-concierge-link-decoration": "underline",
"--message-max-width": "100%"
}
クライアントサイドのイベントとコールバック関数 events
イベントコールバックシステムを使用すると、Web クライアントのライフサイクルイベント、ユーザーインタラクション、応答、フィードバック、およびエラーをリアルタイムで確認できます。これは、Adobe Analytics、Google Analytics、またはその他のサードパーティシステムにエンゲージメントデータを送信するのに便利です。
主な特徴 key-characteristics
- 単一のコールバック — 1つの
onEvent関数は、すべてのイベントタイプを受け取り、event.eventTypeで区別します。 - 読み取り専用 — イベントデータは複製されたスナップショットであり、クライアントの動作の変更に使用できません。
- Error-isolated — コールバック内でスローされた例外が検出され、ログに記録されます。Web クライアントは壊れません。
bootstrap()経由で登録 –onBeforeEventSendと同じ方法で合格しました。
クイックスタート quick-start
window.adobe.concierge.bootstrap({
instanceName: "my-instance",
selector: "#brand-concierge-mount",
stylingConfigurations: { /* ... */ },
onEvent: (event) => {
console.log(event.eventType, event.timestamp, event.data);
}
});
イベントタイプによるフィルタリング filtering
onEvent: (event) => {
switch (event.eventType) {
case "query:submitted":
console.log("User query:", event.data.query);
break;
case "response:completed":
console.log("Response received:", event.data.conversationId);
break;
case "card:clicked":
console.log("Card clicked:", event.data.element.entity_info.productName);
break;
case "error:occurred":
console.log("Error:", event.data.errorMessage);
break;
}
}
イベントタイプ event-types
WEBCLIENT_INITIALIZEDwebclient:initializedQUERY_SUBMITTEDquery:submittedPROMPT_SUGGESTION_CLICKEDpromptSuggestion:clickedCARD_CLICKEDcard:clickedHISTORY_CLEAREDhistory:clearedRESPONSE_STARTEDresponse:startedRESPONSE_COMPLETEDresponse:completedCARDS_RENDEREDcards:renderedFEEDBACK_SUBMITTEDfeedback:submittedERROR_OCCURREDerror:occurredライフサイクルイベント lifecycle-events
webclient:initializedは、クライアントが完全に初期化された後に起動します。コンテンツが読み込まれ、CSSが挿入され、DOMでチャット UIがレンダリングされます。
{
"eventType": "webclient:initialized",
"timestamp": 1741638123789,
"data": {
"instanceName": "my-instance"
}
}
ユーザーインタラクションイベント user-interaction-events
query:submittedは、ユーザーが入力されたメッセージ、プロンプトの提案、またはウィジェットオプションからメッセージを送信したときに発生します。
{
"eventType": "query:submitted",
"timestamp": 1741638124000,
"data": {
"query": "What photo editing tools do you offer?"
}
}
promptSuggestion:clickedは、ユーザーがプロンプト候補ピルをクリックすると起動します。 後続のquery:submitted イベントの before を起動します。
{
"eventType": "promptSuggestion:clicked",
"timestamp": 1741638124100,
"data": {
"suggestion": "Tell me more about Photoshop"
}
}
ユーザーがカードをクリックすると、card:clickedが起動します。
{
"eventType": "card:clicked",
"timestamp": 1741638124200,
"data": {
"element": {
"entity_info": {
"productName": "Adobe Photoshop",
"productDescription": "Photo editing software",
"productPageURL": "https://www.adobe.com/jp/products/photoshop.html",
"productImageURL": "https://example.com/photoshop.png"
}
}
}
}
ユーザーがclear-chat-history ボタンをクリックすると、history:clearedが起動します。
{
"eventType": "history:cleared",
"timestamp": 1741638124400,
"data": {}
}
応答イベント response-events
response:startedは、最初のストリーミングチャンクがAPIから到着したときに起動します。
{
"eventType": "response:started",
"timestamp": 1741638125000,
"data": {
"conversationId": "conv-abc-123",
"interactionId": "int-xyz-456"
}
}
response:completedは、完全な応答を受信したときに起動します。
{
"eventType": "response:completed",
"timestamp": 1741638126000,
"data": {
"conversationId": "conv-abc-123",
"interactionId": "int-xyz-456"
}
}
cards:renderedは、カードがDOMでレンダリングされた後に起動します。 response:completedとは別に起動し、使用されている表示モードを示します。
{
"eventType": "cards:rendered",
"timestamp": 1741638126100,
"data": {
"element": [
{ "entity_info": { "productName": "Adobe Photoshop" } },
{ "entity_info": { "productName": "Adobe Illustrator" } }
],
"displayMode": "carousel"
}
}
フィードバックイベント feedback-events
feedback:submittedは、ユーザーがフィードバックフォームを入力して送信すると起動します(親指で上下に移動)。
{
"eventType": "feedback:submitted",
"timestamp": 1741638127000,
"data": {
"conversationId": "conv-abc-123",
"interactionId": "int-xyz-456",
"feedbackType": "negative",
"selectedOptions": ["Incorrect information", "Not relevant"],
"notes": "The response did not address my question about pricing."
}
}
エラーイベント error-events
error:occurredは、クライアントがネットワーク、API、またはランタイムエラーを検出したときに起動します。
{
"eventType": "error:occurred",
"timestamp": 1741638128000,
"data": {
"errorMessage": "Something went wrong. Please try again."
}
}
イベントオブジェクトの構造 event-object-structure
各イベントは、同じトップレベルのシェイプを共有します。
interface BrandConciergeEvent {
eventType: string; // e.g. "query:submitted"
timestamp: number; // Unix epoch, milliseconds
data: object; // Event-specific payload
}
データタイプ参照:要素(製品カード) element-reference
interface Element {
id?: string;
type?: string;
entity_info: {
productName: string;
productDescription: string;
description: string;
productPageURL: string;
details: string;
backgroundColor: string;
learningResource: string;
productImageURL: string;
logo: string;
variants?: Record<string, ElementVariant>;
primary: ElementAction;
secondary: ElementAction;
};
}
interface ElementAction {
label: string;
url: string;
}
ベストプラクティス best-practices
- 分析と監視に使用します。 エンゲージメント、クエリパターン、製品への関心を追跡します。エラー追跡サービスに
error:occurredを転送します。コンバージョン分析のためにカードのクリックを追跡します。 - コールバックを高速に保持します。 これはメインスレッド上で同期して実行されるので、ネットワーク呼び出しをブロックしないようにする:
// Good — fire and forget
onEvent: (event) => {
navigator.sendBeacon("/analytics", JSON.stringify(event));
}
// Avoid — blocking network call
onEvent: async (event) => {
await fetch("/analytics", { body: JSON.stringify(event) });
}
- 状態マシンに対して厳密なイベント順序を使用しないでください。 イベントは論理的な順序で発生しますが、順序を仮定する代わりに
conversationIdとinteractionIdを使用して関連するイベントを関連付けます。 - 独自のコールバック内のエラーを処理します。 クライアントはコールバックエラーを分離してログに記録しますが、コールバック内の未処理エラーは分析データを失う可能性があります。
onEvent: (event) => {
try {
myAnalytics.track(event);
} catch (e) {
console.warn("Analytics tracking failed", e);
}
}
AEP Query Serviceを使用した会話の書き出し export-conversations
Brand Conciergeは、プロンプト、応答、フィードバックなどの会話データをAdobe Experience Platform(AEP)データセットに書き込みます。 クエリサービス(SQL)を使用して直接クエリし、カスタムレポートを作成できます。
データセットとテーブル名を見つける find-dataset
-
Adobe Experience Platformを開きます。
-
データセットに移動します。
-
cja_brand_conciergeを検索して、Brand Conciergeに関連するデータセットを一覧表示します。 -
必要なデータセットを開きます(複数が存在する場合、回答と他のフローなど)。
-
データセットの詳細ビューで、クエリサービスで使用される テーブル名 を見つけ、サンプルまたはプレビューデータを調べて、列(プロンプト、応答、フィードバック、タイムスタンプなど)を確認します。
クエリの例 example-query
SELECT *
FROM cja_brand_concierge_responses_dataset_5f5105bd_1c38_4ebc_8505_bd
WHERE timestamp >= TIMESTAMP '2026-03-16 00:00:00'
AND timestamp <= NOW()
ORDER BY timestamp ASC;
クエリサービス UIでのクエリの実行 run-query-ui
レポート用の手動データプルが必要な場合、クエリサービス UIには、結果を直接実行してダウンロードする方法が用意されています。
-
Adobe Experience Platformで、Queriesに移動します。
-
エディターにクエリを入力し、クエリを実行をクリックします。
-
クエリが完了すると、結果はエディターの下の結果 タブに表示されます。 そこから、結果をダウンロードできます。
関連トピックス further-reading
- Query Service API ドキュメント – このガイドとは関係なく、時間の経過とともに変化するQuery Serviceの動作、制限、認証、およびAPI パスに関するAdobeの公式リファレンス。