の概要 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 テスト アクティビティは、ほぼゼロの待ち時間で実行されます。 この機能を有効にするには、次に移動します。 管理 > 実装 > アカウントの詳細 をクリックし、 オンデバイス判定 切り替え

代替画像

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. In Targetをクリックし、 アクティビティ ページ、「 」を選択します。 アクティビティを作成 > A/B テスト.

    代替画像

  2. Adobe Analytics の A/B テストアクティビティの作成 モーダルの場合、デフォルトの Web オプションを選択したまま (1)、 フォーム experience composer (2) として、「 」を選択します。 デフォルトのワークスペース 次を使用 プロパティの制限がありません(3) をクリックし、 次へ (4)。

    代替画像

  3. Adobe Analytics の エクスペリエンス アクティビティを作成する手順で、アクティビティの名前を指定し (1)、2 つ目のエクスペリエンス「エクスペリエンス B」を「 エクスペリエンスを追加 (2)。 選択した場所の名前を入力します (3)。 例: ondevice-featureflag または homepage-addtocart-featureflag は、機能フラグテストの宛先を示す場所名です。 次の例では、 ondevice-featureflag は、エクスペリエンス B 用に定義された場所です。オプションで、オーディエンスの絞り込み (4) を追加して、認定をアクティビティに制限できます。

    代替画像

  4. Adobe Analytics の コンテンツ セクションで、「 JSON オファーを作成 を (1) に設定します。

    代替画像

  5. Adobe Analytics の 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. Adobe Analytics の ターゲット設定 以下に示す手順の例では、シンプルにするために、オーディエンスのターゲット設定 (2) はすべての訪問者のデフォルトセットのままです。 これは、アクティビティがターゲティング解除されたことを意味します。 ただし、Adobeでは、実稼動アクティビティでは常にオーディエンスのターゲット設定をおこなうことをお勧めします。 クリック 次へ (3) に進む 目標と設定 アクティビティ作成のステップ。

    代替画像

  8. Adobe Analytics の 目標と設定 ステップ、設定 レポートソース から Adobe Target (1)。 次を定義: 目標指標 as コンバージョン ​を使用して、サイトのコンバージョン指標に基づいて詳細を指定します (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