시작하기 Target SDK

시작하고 실행하기 위해 첫 번째 항목을 만드는 것이 좋습니다 온디바이스 의사 결정 기능 플래그 활동을 선택한 언어로 표시:

  • Node.js
  • Java
  • .NET
  • Python

단계 요약

  1. 조직에 대해 온디바이스 의사 결정 활성화
  2. SDK 설치
  3. SDK 초기화
  4. 에서 기능 플래그 설정 Adobe Target A/B 테스트 활동
  5. 응용 프로그램에서 기능 구현 및 렌더링
  6. 애플리케이션의 이벤트에 대한 추적 구현
  7. 활성화 A/B 테스트 활동

1. 조직에 대해 온디바이스 의사 결정 사용

디바이스에서 의사 결정을 활성화하면 A/B 테스트 활동이 거의 0에 가까운 지연 시간에 실행됩니다. 이 기능을 사용하려면 다음 위치로 이동하십시오. 관리 > 구현 > 계정 세부 정보 및 활성화 온디바이스 의사 결정 토글.

대체 이미지

NOTE
다음을 보유해야 합니다. 관리자 또는 승인자 사용자 역할 을(를) 활성화 또는 비활성화하려면 온디바이스 의사 결정 토글.

활성화 후 온디바이스 의사 결정 전환, Adobe Target 생성 시작 규칙 아티팩트 클라이언트.

2. SDK 설치

Node.js, Java 및 Python의 경우 터미널의 프로젝트 디렉터리에서 다음 명령을 실행합니다. .NET의 경우 다음 방법으로 종속으로 추가합니다. nuGet에서 설치.

Node.js (NPM)
code language-js line-numbers
npm i @adobe/target-nodejs-sdk -P
Java(Maven)
code language-javascript line-numbers
<dependency>
   <groupId>com.adobe.target</groupId>
   <artifactId>java-sdk</artifactId>
   <version>2.0</version>
</dependency>
.NET (Bash)
code language-bash line-numbers
dotnet add package Adobe.Target.Client
Python(pip)
code language-python line-numbers
pip install target-python-sdk

3. SDK 초기화

규칙 아티팩트는 SDK 초기화 단계 중에 다운로드됩니다. 초기화 단계를 사용자 정의하여 아티팩트가 다운로드되고 사용되는 방법을 결정할 수 있습니다.

Node.js
code language-js line-numbers
const TargetClient = require("@adobe/target-nodejs-sdk");

const CONFIG = {
   client: "<your target client code>",
   organizationId: "your EC org id",
   decisioningMethod: "on-device",
   events: {
      clientReady: targetClientReady
      }
};

const tClient = TargetClient.create(CONFIG);

function targetClientReady() {
   //Adobe Target SDK has now downloaded the JSON artifact locally, which contains the activity details.
   //We will see how to use the artifact here very soon.
}
Java(Maven)
code language-javascript line-numbers
ClientConfig config = ClientConfig.builder()
   .client("testClient")
   .organizationId("ABCDEF012345677890ABCDEF0@AdobeOrg")
   .build();
TargetClient targetClient = TargetClient.create(config);
.NET (C#)
code language-csharp line-numbers
var targetClientConfig = new TargetClientConfig.Builder("testClient", "ABCDEF012345677890ABCDEF0@AdobeOrg")
   .Build();
this.targetClient.Initialize(targetClientConfig);
Python
code language-python line-numbers
from target_python_sdk import TargetClient

def target_client_ready():
   # Adobe Target SDK has now downloaded the JSON artifact locally, which contains the activity details.
   # We will see how to use the artifact here very soon.

CONFIG = {
   "client": "<your target client code>",
   "organization_id": "your EC org id",
   "decisioning_method": "on-device",
   "events": {
      "client_ready": target_client_ready
   }
}

target_client = TargetClient.create(CONFIG)

4. 기능 플래그를 설정합니다. Adobe Target A/B 테스트 활동

  1. 위치 Target로 이동한 다음 활동 페이지를 선택한 다음 활동 만들기 > A/B 테스트.

    대체 이미지

  2. 다음에서 A/B 테스트 활동 만들기 모달에서 기본 웹 옵션을 선택한 상태로 둡니다(1). 다음을 선택합니다. 양식 경험 작성기 (2)로서 기본 작업 영역 포함 속성 제한 없음(3) 을 클릭한 다음 다음 (4)

    대체 이미지

  3. 다음에서 경험 활동 만들기 단계에서 활동(1)의 이름을 입력하고 를 클릭하여 두 번째 경험인 경험 B를 추가합니다. 경험 추가 (2) 선택한 위치 이름을 입력합니다(3). 예를 들어, ondevice-featureflag 또는 homepage-addtocart-featureflag 기능 플래그 테스트 대상을 나타내는 위치 이름입니다. 아래 표시된 예에서는 ondevice-featureflag 은 경험 B에 대해 정의된 위치입니다. 필요에 따라 대상 세분화(4)를 추가하여 활동에 자격을 제한할 수 있습니다.

    대체 이미지

  4. 다음에서 콘텐츠 동일한 페이지의 섹션에서 다음을 선택합니다. JSON 오퍼 만들기 (1)을 클릭합니다.

    대체 이미지

  5. 다음에서 JSON 데이터 표시되는 텍스트 상자에 유효한 JSON 개체(2)를 사용하여 각 경험(1)에 대한 기능 플래그 변수를 입력합니다.

    경험 A에 대한 기능 플래그 변수를 입력합니다.

    대체 이미지

    (위의 경험 A에 대한 샘플 JSON)

    code language-json line-numbers
       {
       "enabled" : true,
       "flag" : "expA"
    }
    

    경험 B에 대한 기능 플래그 변수를 입력합니다.

    대체 이미지

    (위의 경험 B에 대한 샘플 JSON)

    code language-json line-numbers
       {
       "enabled" : true,
       "flag" : "expB"
    }
    
  6. 클릭 다음 (1) (으)로 이동 타겟팅 활동 만들기 단계입니다.

    대체 이미지

  7. 다음에서 타겟팅 아래 표시된 단계 예와 같이, 단순성을 위해 대상 타깃팅(2)은 모든 방문자의 기본 세트에 유지됩니다. 즉, 활동이 타깃팅되지 않습니다. 그러나 참고 Adobe은 항상 프로덕션 활동의 대상을 타기팅하는 것을 권장합니다. 클릭 다음 (3) (으)로 이동 목표 및 설정 활동 만들기 단계입니다.

    대체 이미지

  8. 다음에서 목표 및 설정 단계, 설정 보고 소스Adobe Target (1) 다음을 정의합니다. 목표 지표 다음으로: 전환 ​를 클릭하고 사이트의 전환 지표를 기반으로 세부 사항을 지정합니다(2). 클릭 저장 및 닫기 (3) 활동을 저장합니다.

    대체 이미지

5. 응용 프로그램에서 기능 구현 및 렌더링

에서 기능 플래그 변수를 설정한 후 Target를 클릭하고 애플리케이션 코드를 수정하여 이를 사용합니다. 예를 들어 애플리케이션에서 기능 플래그를 가져온 후 이를 사용하여 기능을 활성화하고 방문자가 자격을 부여받은 경험을 렌더링할 수 있습니다.

Node.js
code language-js line-numbers
//... Code removed for brevity
​
let featureFlags = {};
​
function targetClientReady() {
   tClient.getAttributes(["ondevice-featureflag"]).then(function(response) {
      const featureFlags = response.asObject("ondevice-featureflag");
      if(featureFlags.enabled && featureFlags.flag !== "expA") { //Assuming "expA" is control
         console.log("Render alternate experience" + featureFlags.flag);
      }
      else {
         console.log("Render default experience");
      }
   });
}
Java(Maven)
code language-javascript line-numbers
MboxRequest mbox = new MboxRequest().name("ondevice-featureflag").index(0);
TargetDeliveryRequest request = TargetDeliveryRequest.builder()
   .context(new Context().channel(ChannelType.WEB))
   .execute(new ExecuteRequest().mboxes(Arrays.asList(mbox)))
   .build();
Attributes attributes = targetClient.getAttributes(request, "ondevice-featureflag");
String flag = attributes.getString("ondevice-featureflag", "flag");
.NET (C#)
code language-csharp line-numbers
var mbox = new MboxRequest(index: 0, name: "ondevice-featureflag");
var deliveryRequest = new TargetDeliveryRequest.Builder()
   .SetContext(new Context(ChannelType.Web))
   .SetExecute(new ExecuteRequest(mboxes: new List<MboxRequest> { mbox }))
   .Build();
var attributes = targetClient.GetAttributes(request, "ondevice-featureflag");
var flag = attributes.GetString("ondevice-featureflag", "flag");
Python
code language-python line-numbers
# ... Code removed for brevity

feature_flags = {}

def target_client_ready():
   attribute_provider = target_client.get_attributes(["ondevice-featureflag"])
   feature_flags = attribute_provider.as_object(mbox_name="ondevice-featureflag")
   if feature_flags.get("enabled") and feature_flags.get("flag") != "expA": # Assuming "expA" is control
      print("Render alternate experience {}".format(feature_flags.get("flag")))
   else:
      print("Render default experience")

6. 애플리케이션의 이벤트에 대한 추가 추적 구현

선택적으로 sendNotification() 함수를 사용하여 전환 추적을 위한 추가 이벤트를 보낼 수 있습니다.

Node.js
code language-js line-numbers
//... Code removed for brevity
​
//When a conversion happens
TargetClient.sendNotifications({
   targetCookie,
   "request" : {
      "notifications" : [
      {
         type: "display",
         timestamp : Date.now(),
         id: "conversion",
         mbox : {
            name : "orderConfirm"
         },
         order : {
            id: "BR9389",
            total : 98.93,
            purchasedProductIds : ["J9393", "3DJJ3"]
         }
      }
      ]
   }
})
Java(Maven)
code language-javascript line-numbers
Notification notification = new Notification();
notification.setId("conversion");
notification.setImpressionId(UUID.randomUUID().toString());
notification.setType(MetricType.DISPLAY);
notification.setTimestamp(System.currentTimeMillis());
Order order = new Order("BR9389");
order.total(98.93);
order.purchasedProductIds(["J9393", "3DJJ3"]);
notification.setOrder(order);

TargetDeliveryRequest notificationRequest =
   TargetDeliveryRequest.builder()
      .context(new Context().channel(ChannelType.WEB))
      .notifications(Collections.singletonList(notification))
      .build();

NotificationDeliveryService notificationDeliveryService = new NotificationDeliveryService();
notificationDeliveryService.sendNotification(notificationRequest);
.NET (C#)
code language-csharp line-numbers
var order = new Order
{
   Id = "BR9389",
   Total = 98.93M,
   PurchasedProductIds = new List<string> { "J9393", "3DJJ3" },
};
​
var notification = new Notification
{
   Id = "conversion",
   ImpressionId = Guid.NewGuid().ToString(),
   Type = MetricType.Display,
   Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
   Order = order,
};
​
var notificationRequest = new TargetDeliveryRequest.Builder()
   .SetContext(new Context(ChannelType.Web))
   .SetNotifications(new List<Notification> {notification})
   .Build();
​
targetClient.SendNotifications(notificationRequest);
Python
code language-python line-numbers
# ... Code removed for brevity

# When a conversion happens
notification_mbox = NotificationMbox(name="orderConfirm")
order = Order(id="BR9389, total=98.93, purchased_product_ids=["J9393", "3DJJ3"])
notification = Notification(
   id="conversion",
   type=MetricType.DISPLAY,
   timestamp=1621530726000,  # Epoch time in milliseconds
   mbox=notification_mbox,
   order=order
)
notification_request = DeliveryRequest(notifications=[notification])


target_client.send_notifications({
   "target_cookie": target_cookie,
   "request" : notification_request
})

7. 활성화 A/B 테스트 활동

  1. 클릭 활성화 (1) 를 활성화하려면 A/B 테스트 활동.

    note note
    NOTE
    다음을 보유해야 합니다. 승인자 또는 게시자 사용자 역할 을 눌러 이 단계를 수행합니다.

    대체 이미지

recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3