이 페이지에서: 응용 프로그램에서 코드 기반 경험 콘텐츠를 가져오고, 표시하고, 추적하기 위한 클라이언트측, 서버측 및 하이브리드 구현 샘플을 살펴봅니다.
코드 기반 경험은 모든 유형의 고객 구현을 지원합니다. 이 페이지에서는 각 구현 방법에 대한 샘플을 찾을 수 있습니다.
➡️ 코드 기반 경험 및 의사 결정을 위한 Web SDK 구성에 대한 자세한 내용은 이러한 자습서를 참조하세요.
클라이언트측 구현 client-side-implementation
클라이언트측 구현이 있는 경우 AEP 클라이언트 SDK 중 하나인 AEP Web SDK 또는 AEP Mobile SDK을 사용할 수 있습니다.
작동 방법 - 웹 SDK client-side-how
-
웹 SDK이(가) 페이지에 포함되어 있습니다.
-
개인화 콘텐츠를 가져오려면
sendEvent명령을 사용하고 표면 URI를 지정해야 합니다.code language-javascript alloy("sendEvent", { renderDecisions: true, personalization: { surfaces: ["#sample-json-content"], }, }).then(applyPersonalization("#sample-json-content")); -
결정에 따라 DOM을 업데이트하려면 구현 코드(
applyPersonalization메서드 사용)에서 코드 기반 경험 항목을 수동으로 적용해야 합니다. -
코드 기반 경험 여정 및 캠페인의 경우 콘텐츠가 표시된 시기를 나타내기 위해 표시 이벤트를 수동으로 보내야 합니다. 이 작업은
sendEvent명령을 통해 수행됩니다.code language-javascript function sendDisplayEvent(decision) { const { id, scope, scopeDetails = {} } = decision; alloy("sendEvent", { xdm: { eventType: "decisioning.propositionDisplay", _experience: { decisioning: { propositions: [ { id: id, scope: scope, scopeDetails: scopeDetails, }, ], }, }, }, }); } -
코드 기반 경험 여정 및 캠페인의 경우 사용자가 콘텐츠와 상호 작용한 시기를 나타내기 위해 상호 작용 이벤트를 수동으로 전송해야 합니다. 이 작업은
sendEvent명령을 통해 수행됩니다.code language-javascript function sendInteractEvent(label, proposition) { const { id, scope, scopeDetails = {} } = proposition; alloy("sendEvent", { xdm: { eventType: "decisioning.propositionInteract", _experience: { decisioning: { propositions: [ { id: id, scope: scope, scopeDetails: scopeDetails, }, ], propositionEventType: { interact: 1 }, propositionAction: { id: label, label: label, tokens: proposition.items?.[0]?.characteristics?.tokens || [] }, }, }, }, }); }note important IMPORTANT propositionAction의tokens필드는 Adobe Journey Optimizer Decisioning에서 정확한 추적 및 속성에 중요합니다. 이러한 토큰을 사용하면 다음 작업을 수행할 수 있습니다.- 의사 결정 활동에 대한 적절한 클릭 속성
- 의사 결정 콘텐츠와의 사용자 상호 작용에 대한 정확한 보고
- 사용자 참여를 기반으로 오퍼 성능 최적화
토큰은 일반적으로 proposition.items[0].characteristics.tokens에서 찾을 수 있으며 결정 콘텐츠와의 사용자 상호 작용을 추적할 때 항상 포함되어야 합니다.
주요 관찰
쿠키
쿠키는 사용자 ID 및 클러스터 정보를 유지하는 데 사용됩니다. 클라이언트측 구현을 사용하는 경우 웹 SDK은 요청 라이프사이클 동안 이러한 쿠키의 저장 및 전송을 자동으로 처리합니다.
배치 요청
제안을 가져오고 디스플레이 알림을 보내려면 Adobe Experience Platform API에 대한 요청이 필요합니다. 클라이언트측 구현을 사용하는 경우 sendEvent 명령이 사용될 때 웹 SDK에서 이러한 요청을 수행합니다.
흐름 다이어그램
서버측 구현 server-side-implementation
서버측 구현이 있는 경우 AEP Edge Network API를 사용할 수 있습니다.
아래 절차에서는 웹 페이지에 대한 샘플 Edge Network API 구현에서 코드 기반 경험 여정 및 캠페인에 의해 에지에 게시된 콘텐츠를 가져오고 개인화된 콘텐츠를 표시하는 프로세스를 설명합니다.
작동 방식
-
웹 페이지가 요청되고 브라우저에서 이전에 저장한 쿠키(
kndctr_접두사)가 포함됩니다. -
앱 서버에서 페이지를 요청하면 대화형 데이터 수집 끝점으로 이벤트를 전송하여 개인화 콘텐츠를 가져옵니다. 이 샘플 앱은 몇 가지 도우미 메서드를 사용하여 API에 대한 요청 빌드 및 전송을 단순화합니다(aepEdgeClient.js 참조). 하지만 이 요청은 이벤트 및 쿼리가 포함된 페이로드가 있는
POST입니다. 이전 단계의 쿠키(사용 가능한 경우)는meta>state>entries배열의 요청에 포함됩니다.code language-javascript fetch( "https://edge.adobedc.net/ee/v2/interact?dataStreamId=abc&requestId=123", { headers: { accept: "*/*", "accept-language": "en-US,en;q=0.9", "cache-control": "no-cache", "content-type": "text/plain; charset=UTF-8", pragma: "no-cache", "sec-fetch-dest": "empty", "sec-fetch-mode": "cors", "sec-fetch-site": "cross-site", "sec-gpc": "1", "Referrer-Policy": "strict-origin-when-cross-origin", Referer: "https://localhost/", }, body: JSON.stringify({ event: { xdm: { eventType: "decisioning.propositionFetch", web: { webPageDetails: { URL: "https://localhost/", }, webReferrer: { URL: "", }, }, identityMap: { FPID: [ { id: "xyz", authenticatedState: "ambiguous", primary: true, }, ], }, timestamp: "2022-06-23T22:21:00.878Z", }, data: {}, }, query: { identity: { fetch: ["ECID"], }, personalization: { schemas: [ "https://ns.adobe.com/personalization/default-content-item", "https://ns.adobe.com/personalization/html-content-item", "https://ns.adobe.com/personalization/json-content-item", "https://ns.adobe.com/personalization/redirect-item", "https://ns.adobe.com/personalization/dom-action", ], surfaces: ["web://localhost/","web://localhost/#sample-json-content"], }, }, meta: { state: { domain: "localhost", cookiesEnabled: true, entries: [ { key: "kndctr_XXX_AdobeOrg_identity", value: "abc123", }, { key: "kndctr_XXX_AdobeOrg_cluster", value: "or2", }, ], }, }, }), method: "POST", } ).then((res) => res.json()); -
코드 기반 경험 여정 및 캠페인의 JSON 경험은 응답에서 읽으며 HTML 응답을 생성할 때 사용됩니다.
-
코드 기반 경험 여정 및 캠페인의 경우 여정 또는 캠페인 컨텐츠가 표시된 시기를 나타내기 위해 표시 이벤트를 구현에서 수동으로 보내야 합니다. 이 예에서 알림은 요청 라이프사이클 동안 서버측에서 전송됩니다.
code language-javascript function sendDisplayEvent(aepEdgeClient, req, propositions, cookieEntries) { const address = getAddress(req); aepEdgeClient.interact( { event: { xdm: { web: { webPageDetails: { URL: address }, webReferrer: { URL: "" }, }, timestamp: new Date().toISOString(), eventType: "decisioning.propositionDisplay", _experience: { decisioning: { propositions: propositions.map((proposition) => { const { id, scope, scopeDetails } = proposition; return { id, scope, scopeDetails, }; }), }, }, }, }, query: { identity: { fetch: ["ECID"] } }, meta: { state: { domain: "", cookiesEnabled: true, entries: [...cookieEntries], }, }, }, { Referer: address, } ); } -
HTML 응답이 반환되면 ID 및 클러스터 쿠키가 애플리케이션 서버에 의한 응답에 설정됩니다.
주요 관찰
쿠키
쿠키는 사용자 ID 및 클러스터 정보를 유지하는 데 사용됩니다. 서버측 구현을 사용하는 경우 애플리케이션 서버는 요청 라이프사이클 동안 이러한 쿠키의 저장 및 전송을 처리해야 합니다.
배치 요청
제안을 가져오고 디스플레이 알림을 보내려면 Adobe Experience Platform API에 대한 요청이 필요합니다. 클라이언트측 구현을 사용하는 경우 sendEvent 명령이 사용될 때 웹 SDK에서 이러한 요청을 수행합니다.
흐름 다이어그램
하이브리드 구현 hybrid-implementation
하이브리드 구현이 있는 경우 아래 링크를 확인하십시오.
Adobe Experience Platform Assurance를 사용하여 Edge Network API 호출 디버그 debugging-edge-api-assurance
코드 기반 경험을 위해 Edge Network API를 직접 사용할 때(웹 SDK 또는 모바일 SDK을 사용하지 않음), Assurance 세션 ID를 유효성 검사 토큰 헤더로 포함하여 Adobe Experience Platform Assurance에서 API 호출을 디버그할 수 있습니다.
-
활성 Adobe Experience Platform Assurance 세션에서 Assurance 세션 ID를 가져오거나 Assurance API를 사용하여 만듭니다.
-
Assurance 세션 ID를 사용하여
x-adobe-aep-validation-token헤더를 추가하여 Assurance 세션을 통해 Edge Network API 요청을 라우팅합니다.예:
code language-bash curl -v 'https://edge.adobedc.net/ee/v1/interact?configId={DATASTREAM_ID}&requestId={REQUEST_ID}' \ --header 'Content-Type: application/json' \ --header 'x-adobe-aep-validation-token: {ASSURANCE_SESSION_ID}' \ --data-raw '{ "xdm": { "identityMap": { "ECID": [ { "id": "{ECID_VALUE}" } ] } }, "events": [ { "xdm": { "eventType": "test", "timestamp": "{TIMESTAMP}" } } ] }' -
구성이 완료되면 Assurance 세션을 열고 Edge Delivery 보기를 선택하여 요청 페이로드, 응답 콘텐츠, 개인화 제안 및 오류 메시지를 비롯한 Edge Network API 요청 및 응답을 실시간으로 확인합니다.
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 gives client-side, server-side, and hybrid implementation samples for fetching, displaying, and tracking code-based experience content in your application, and explains how to debug Edge Network API calls with Adobe Experience Platform Assurance.
Intents:
- Fetch the content published on the edge by code-based experience journeys and campaigns in a Web SDK implementation, with the
sendEventcommand and a surface URI. - In a client-side Web SDK implementation, track code-based experience content with display events (
decisioning.propositionDisplay) and interaction events (decisioning.propositionInteract) sent with thesendEventcommand. - In a server-side implementation, fetch personalization content with a
POSTrequest to the interactive data collection endpoint of the Edge Network API, with thekndctr_cookies included in themeta>state>entriesarray. - Find resources for a hybrid implementation: the Adobe Tech Blog article and the SDK documentation on hybrid personalization.
- Debug Edge Network API calls for code-based experiences with Adobe Experience Platform Assurance by including the Assurance session ID as a validation token header.
Glossary:
kndctr_AdobeOrg_identitycookie (product-specific): A cookie that contains user identity details.kndctr_AdobeOrg_clustercookie (product-specific): A cookie that indicates which experience edge cluster should be used to fulfill requests.tokensfield inpropositionAction(product-specific): A field that is critical for accurate tracking and attribution in Adobe Journey Optimizer Decisioning. The tokens enable proper click attribution for decisioning activities, accurate reporting of user interactions with decision content, and optimization of offer performance based on user engagement. They are typically found inproposition.items[0].characteristics.tokens.x-adobe-aep-validation-tokenheader (product-specific): The header that carries your Assurance session ID to route your Edge Network API requests through the Assurance session.- Edge Delivery view (product-specific): The Assurance session view that shows Edge Network API requests and responses in real-time, including request payloads, response content, personalization propositions, and error messages.
Guardrails:
- In a client-side Web SDK implementation, code-based experience items should be manually applied by the implementation code (using the
applyPersonalizationmethod) to update the DOM based on the decision. - For code-based experience journeys and campaigns, display events must manually be sent to indicate when the content has been displayed.
- For code-based experience journeys and campaigns, interaction events must manually be sent to indicate when a user has interacted with the content.
- The
tokensfield inpropositionActionshould always be included when tracking user interactions with decision content. - In a server-side implementation, the application server must handle the storing and sending of the identity and cluster cookies during the request lifecycle.
Terminology:
- Canonical name: Adobe Experience Platform — Acronym: AEP
- Canonical name: Web SDK — variants: AEP Web SDK
- Canonical name: Mobile SDK — variants: AEP Mobile SDK
- Canonical name: Edge Network API — variants: AEP Edge Network API, edge network API
- Canonical name: Adobe Experience Platform Assurance — variants: Assurance
- Do not confuse: “display event” (
decisioning.propositionDisplay) ≠ “interaction event” (decisioning.propositionInteract)
FAQ:
- Which SDKs can a client-side implementation use? One of the AEP client SDKs: AEP Web SDK or AEP Mobile SDK. The steps to implement the code-based channel using Mobile SDK are described in a Mobile SDK tutorial, and sample implementations for mobile use cases are available for an iOS app and an Android app.
- Who stores and sends the identity and cluster cookies? In a client-side implementation, the Web SDK handles the storing and sending of these cookies automatically during the request lifecycle. In a server-side implementation, the application server must handle it.
- Who makes the interact requests to get propositions and send display notifications? In a client-side implementation, the Web SDK, using the
sendEventcommand. In a server-side implementation, the application server, calling the Adobe Experience Platform API. - How are the cookies included in a server-side request? The cookies previously stored by the browser prefixed with
kndctr_(if available) are included with the request in themeta>state>entriesarray. When the HTML response is returned, the identity and cluster cookies are set on the response by the application server. - Why include the
tokensfield when sending interaction events? The tokens enable proper click attribution for decisioning activities, accurate reporting of user interactions with decision content, and optimization of offer performance based on user engagement. - How do I see my Edge Network API requests in Assurance? Get your Assurance session ID from an active Adobe Experience Platform Assurance session, or create one using the Assurance API, and add it in the
x-adobe-aep-validation-tokenheader. Then open your Assurance session and select the Edge Delivery view.
Examples:
- Client-side fetch with the Web SDK:
alloy("sendEvent", { renderDecisions: true, personalization: { surfaces: ["#sample-json-content"] } }), followed byapplyPersonalization("#sample-json-content"). - Server-side fetch: a
POSTrequest tohttps://edge.adobedc.net/ee/v2/interact?dataStreamId=abc&requestId=123with the event typedecisioning.propositionFetchand the surfacesweb://localhost/andweb://localhost/#sample-json-content. The sample app uses helper methods (aepEdgeClient.js) to simplify building and sending requests to the API. - Server-side display event: in the sample, the notification is sent server-side during the request lifecycle, with
aepEdgeClient.interactand the event typedecisioning.propositionDisplay. - Assurance debugging: a
curlrequest tohttps://edge.adobedc.net/ee/v1/interact?configId={DATASTREAM_ID}&requestId={REQUEST_ID}with the headerx-adobe-aep-validation-token: {ASSURANCE_SESSION_ID}.
Related pages:
- To configure the Web SDK for code-based experiences and decisioning: Decisioning in code-based experience implementations
- For the surface URI to specify in the
sendEventcommand: surface URI
Personas:
- developer: Can fetch the content published on the edge by code-based experience journeys and campaigns with the Web SDK
sendEventcommand and a surface URI. Can send display events with thedecisioning.propositionDisplayevent type and interaction events with thedecisioning.propositionInteractevent type. Can fetch personalization content server-side with aPOSTrequest to the interactive data collection endpoint, with thekndctr_cookies in themeta>state>entriesarray. Can add thex-adobe-aep-validation-tokenheader with an Assurance session ID to debug Edge Network API calls. The page states that thetokensfield inpropositionActionshould always be included when tracking user interactions with decision content. Where: “Code-based implementation methods samples”.
Onboarding:
- Level: Experienced
- First minimal step: Use the
sendEventcommand and specify the surface URI to fetch personalization content. - Success check: When directly using the Edge Network API, the Edge Delivery view of your Assurance session shows Edge Network API requests and responses in real-time.