Target SDKを Optimize SDKに置き換えます。

モバイル実装でAdobe Target SDK を最適化 SDK に置き換える方法を説明します。 基本的な置き換えは、次の手順で構成されます。

  • Podfile または build.gradle ファイルの依存関係を更新します
  • 読み込みを更新
  • アプリケーションコードを更新
INFO
Adobe Experience Platform Mobile SDK エコシステム内では、拡張機能は、アプリケーションに読み込まれた、名前が異なる可能性のある SDK によって実装されます。
  • Target SDK は、Adobe Target拡張機能を実装しています
  • SDKの最適化 は、Offer Decisioningおよび Target 拡張機能を実装します

依存関係の更新

Androidの例
tabs
SDKの最適化

移行後の build.gradle 依存関係

code language-java
implementation platform('com.adobe.marketing.mobile:sdk-bom:3.+')
implementation 'com.adobe.marketing.mobile:core'
implementation 'com.adobe.marketing.mobile:edgeidentity'
implementation 'com.adobe.marketing.mobile:edge'
implementation 'com.adobe.marketing.mobile:optimize'
Target SDK

移行前に build.gradle 依存関係

code language-java
implementation platform('com.adobe.marketing.mobile:sdk-bom:3.+')
implementation 'com.adobe.marketing.mobile:analytics'
implementation 'com.adobe.marketing.mobile:target'
implementation 'com.adobe.marketing.mobile:core'
implementation 'com.adobe.marketing.mobile:identity'
implementation 'com.adobe.marketing.mobile:lifecycle'
implementation 'com.adobe.marketing.mobile:signal'
implementation 'com.adobe.marketing.mobile:userprofile'
iOSの例
tabs
SDKの最適化

移行後の Podfile 依存関係

code language-swift
use_frameworks!
target 'YourAppTarget' do
    pod 'AEPCore', '~> 5.0'
    pod 'AEPEdge', '~> 5.0'
    pod 'AEPEdgeIdentity', '~> 5.0'
    pod 'AEPOptimize', '~> 5.0'
end
Target SDK

移行前に Podfile 依存関係

code language-swift
use_frameworks!
pod 'AEPAnalytics', '~> 5.0'
pod 'AEPTarget', '~> 5.0'
pod 'AEPCore', '~> 5.0'
pod 'AEPIdentity', '~> 5.0'
pod 'AEPSignal', '~>5.0'
pod 'AEPLifecycle', '~>5.0'
pod 'AEPUserProfile', '~> 5.0'

インポートとコードの更新

Androidの例
tabs
SDKの最適化

移行後の Java 初期化コード

code language-java
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Edge;
import com.adobe.marketing.mobile.edge.identity.Identity;
import com.adobe.marketing.mobile.optimize.Optimize;
import com.adobe.marketing.mobile.AdobeCallback;

public class MainApp extends Application {

  private final String ENVIRONMENT_FILE_ID = "YOUR_APP_ENVIRONMENT_ID";

    @Override
    public void onCreate() {
        super.onCreate();

        MobileCore.setApplication(this);
        MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID);

        MobileCore.registerExtensions(
            Arrays.asList(Edge.EXTENSION, Identity.EXTENSION, Optimize.EXTENSION),
            o -> Log.d("MainApp", "Offer Decisioning and Target Mobile SDK was initialized.")
        );
    }
}
Target SDK

移行前の Java 初期化コード

code language-java
import com.adobe.marketing.mobile.AdobeCallback;
import com.adobe.marketing.mobile.Analytics;
import com.adobe.marketing.mobile.Extension;
import com.adobe.marketing.mobile.Identity;
import com.adobe.marketing.mobile.Lifecycle;
import com.adobe.marketing.mobile.LoggingMode;
import com.adobe.marketing.mobile.MobileCore;
import com.adobe.marketing.mobile.Signal;
import com.adobe.marketing.mobile.Target;
import com.adobe.marketing.mobile.UserProfile;
import java.util.Arrays;
import java.util.List;
...
import android.app.Application;
...
public class MainApp extends Application {
...
    @Override
    public void onCreate() {
        super.onCreate();
        MobileCore.setApplication(this);
        MobileCore.setLogLevel(LoggingMode.DEBUG);
        ...
        List<Class<? extends Extension>> extensions = Arrays.asList(
            Analytics.EXTENSION,
            Target.EXTENSION,
            Identity.EXTENSION,
            Lifecycle.EXTENSION,
            Signal.EXTENSION,
            UserProfile.EXTENSION
        );


        MobileCore.registerExtensions(extensions, new AdobeCallback () {
            @Override
            public void call(Object o) {
                MobileCore.configureWithAppID(<Environment File ID>);
            }
        });
    }
}
iOS
tabs
SDKの最適化

移行後の Swift 初期化コード

code language-swift
import AEPCore
import AEPEdge
import AEPEdgeIdentity
import AEPOptimize

@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {

      // register the extensions
      MobileCore.registerExtensions([Edge.self, AEPEdgeIdentity.Identity.self, Optimize.self]) {
        MobileCore.configureWith(appId: <YOUR_ENVIRONMENT_FILE_ID>) // Replace <YOUR_ENVIRONMENT_FILE_ID> with a String containing your own ID.
      }

      return true
  }
}
Target SDK

移行前の Swift 初期化コード

code language-swift
import AEPCore
import AEPAnalytics
import AEPTarget
import AEPIdentity
import AEPLifecycle
import AEPSignal
import AEPServices
import AEPUserProfile
...
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        MobileCore.setLogLevel(.debug)
        let appState = application.applicationState
        ...
        let extensions = [
            Analytics.self,
            Target.self,
            Identity.self,
            Lifecycle.self,
            Signal.self,
            UserProfile.self
        ]
        MobileCore.registerExtensions(extensions, {
        MobileCore.configureWith(<Environment File ID>)
        if appState != .background {
            MobileCore.lifecycleStart(additionalContextData: ["contextDataKey": "contextDataVal"])
            }
        })
        ...
        return true
    }
}

API の比較

多くの Target 拡張機能 API は、次の表に示すOffer Decisioning拡張機能と Target 拡張機能を使用して、同等のアプローチを持っています。 functions について詳しくは、API リファレンスを参照してください。

ターゲット拡張機能
Offer Decisioningと Target の拡張機能
メモ
prefetchContent
updatePropositions
retrieveLocationContent
getPropositions
API を使用 getPropositions る場合、SDK内のキャッシュされていないスコープを取得するためのリモート呼び出しは行われません。
displayedLocations
​ オファー – > 表示() ​
さらに、オ generateDisplayInteractionXdm ァー方法を使用して、項目表示用の XDM を生成できます。 その後、Edge network SDKの sendEvent API を使用して、追加の XDM、自由形式のデータを添付し、エクスペリエンスイベントをリモートに送信できます。
clickedLocation
​ オファー – > タップ済み() ​
さらに、オ generateTapInteractionXdm ァー方法を使用して、項目タップ用の XDM を生成できます。 その後、Edge network SDKの sendEvent API を使用して、追加の XDM、自由形式のデータを添付し、エクスペリエンスイベントをリモートに送信できます。
clearPrefetchCache
clearCachedPropositions
resetExperience
該当なし
EdgeのEdge Network ID 拡張機能の removeIdentity API を使用して、SDK ID が訪問者ネットワークに送信されるのを停止します。 詳しくは、removeIdentity API ドキュメント ​ を参照してください。

メモ:Mobile Core の resetIdentities API は、Experience Cloud ID (ECID)を含む、SDKに保存されているすべての ID をクリアするので、使用は慎重に行う必要があります。
getSessionId
該当なし
応答ハンドル state:store、セッション関連の情報を保持します。 Edge network extension は、期限切れでないステートストア項目を後続のリクエストに添付することで、この機能を管理するのに役立ちます。
setSessionId
該当なし
応答ハンドル state:store、セッション関連の情報を保持します。 Edge network extension は、期限切れでないステートストア項目を後続のリクエストに添付することで、この機能を管理するのに役立ちます。
getThirdPartyId
該当なし
Edge Network拡張機能の Identity から updateIdentities API を使用して、サードパーティ ID の値を指定します。 次に、データストリームでサードパーティ ID 名前空間を設定します。 詳しくは、Target サードパーティ ID モバイルのドキュメント ​ を参照してください。
setThirdPartyId
該当なし
Edge Network拡張機能の Identity から updateIdentities API を使用して、サードパーティ ID の値を指定します。 次に、データストリームでサードパーティ ID 名前空間を設定します。 詳しくは、Target サードパーティ ID モバイルのドキュメント ​ を参照してください。
getTntId
該当なし
応答ハンドル locationHint:result、Target の場所のヒント情報を保持します。 Target Edge が Experience Edgeと共存することを前提としています。

Edge ネットワーク拡張機能は、EdgeNetwork の場所のヒントを使用して、要求の送信先となるEdge ネットワーク クラスターを判断します。 SDK (ハイブリッドアプリ)間でEdgeのネットワーク場所のヒントを共有するには、Edge Network拡張機能の getLocationHint および setLocationHint API を使用します。 詳しくは、getLocationHint API ドキュメント ​ を参照してください。
setTntId
該当なし
locationHint:result 応答ハンドルは、Target の場所のヒント情報を保持します。 Target Edge が Experience Edgeと共存することを前提としています。

Edge ネットワーク拡張機能は、EdgeNetwork の場所のヒントを使用して、要求の送信先となるEdge ネットワーク クラスターを判断します。 SDK (ハイブリッドアプリ)間でEdgeのネットワーク場所のヒントを共有するには、Edge Network拡張機能の getLocationHint および setLocationHint API を使用します。 詳しくは、getLocationHint API ドキュメント ​ を参照してください。

次に、ページに ​ アクティビティをリクエストおよびレンダリング ​ する方法を説明します。

NOTE
アドビは、Target 拡張機能からOffer Decisioningおよび Target 拡張機能への Mobile Target の移行を成功させるために取り組んでいます。 移行の際に問題が発生した場合、またはこのガイドに重要な情報が欠落していると感じる場合は、​ このコミュニティのディスカッション ​ に投稿してお知らせください。
recommendation-more-help
23093022-70e6-46bf-81c6-76f79c282c9c