Adobe Experience Platform Mobile SDKとCommerceの統合
Adobe Experience Platform Mobile SDK とCommerce モバイルアプリの統合により、マーチャントはCommerce イベントデータ をExperience Platform エッジに送信できます。
Commerce イベントデータがエッジで使用できる場合、他のAdobe Experience Cloud アプリケーションからアクセスできます。 例えば、データを使用してReal-Time CDPでオーディエンスを作成し、 これらのオーディエンスを使用 してCommerce モバイルアプリをパーソナライズできます。
設定
CommerceでのAdobe Experience Platform Mobile SDKの使用を開始するには、Experience PlatformにSDKをインストールして設定します。 次に、Commerceで設定を最終決定します。
Experience Platform
-
モバイルアプリの機能について詳しくは、 モバイルアプリでのAdobe Experience Cloud チュートリアル を参照してください。
-
Experience PlatformのSDKを インストールして設定 します。
note note NOTE Experience Platformで作成および設定するスキーマは、Commerce モバイルアプリのアプリケーションコードで使用するスキーマと同じです。
Commerce
Experience Platform のSDK設定を完了したら、SDK設定をCommerceに追加します。
-
SDKを介してCommerce イベントデータをExperience Platformに送信するには、アプリケーションコードで XDM スキーマを指定する必要があります。 このスキーマは、Experience PlatformのSDKのスキーマ 設定済み と一致する必要があります。
次の例では、
web.webpagedetails.pageViewsイベントをトラッキングし、メール フィールドを使用してidentityMapを設定する方法を示しています。code language-swift let stateName = "luma: content: ios: us: en: home" var xdmData: [String: Any] = [ "eventType": "web.webpagedetails.pageViews", "web": [ "webPageDetails": [ "pageViews": [ "value": 1 ], "name": "Home page" ] ] ] let experienceEvent = ExperienceEvent(xdm: xdmData) Edge.sendEvent(experienceEvent: experienceEvent) // Adobe Experience Platform - Update Identity let emailLabel = "mobileuser@example.com" let identityMap: IdentityMap = IdentityMap() identityMap.add(item: IdentityItem(id: emailLabel), withNamespace: "Email") Identity.updateIdentities(with: identityMap) -
をCommerce Cloud環境に接続します。
プロジェクトのビルド設定で、Commerce GraphQL エンドポイントへの URL を追加します。 例:
- デバッグ:http://debug.commercesite.cloud/graphql/
- リリース:http://release.commercesite.cloud/graphql/
-
Commerce GraphQL エンドポイントからデータを取得するには、まず Apollo コードジェネレーター を使用して、プロジェクトに必要なファイルとディレクトリを生成します。
-
プロジェクトディレクトリから、install Apollo iOSをインストールします。
-
初期化 Apollo Codegen CLI。
これにより、
apollo-codegen-configuration.jsonファイルが作成されます。 -
apollo-codegen-configuration.jsonファイルの内容を次のように置き換えて、必要なGraphQL ファイルとディレクトリをプロジェクトに生成します。code language-json { "schemaName" : "MagentoAPI", "input" : { "operationSearchPaths" : [ "**/*.graphql" ], "schemaSearchPaths" : [ "**/*.graphqls" ] }, "output" : { "testMocks" : { "none" : { } }, "schemaTypes" : { "path" : "../MagentoAPI", "moduleType" : { "swiftPackageManager" : { } } }, "operations" : { "inSchemaModule" : { } } }, "schemaDownloadConfiguration": { "downloadMethod": { "introspection": { "endpointURL": "http://magento24.com/graphql/", "httpMethod": { "POST": {} }, "includeDeprecatedInputValues": false, "outputFormat": "SDL" } }, "downloadTimeout": 60, "headers": [], "outputPath": "magento.graphqls" } } -
取得 Commerce GraphQL スキーマ。
パスが
./apollo-codegen-config.jsonファイルへのパスであることを確認します。このファイルには、Commerce GraphQL スキーマへの参照が含まれています。 -
生成 ソースコード。
パスが
./apollo-codegen-config.jsonファイルへのパスであることを確認します。このファイルには、必要なファイルとディレクトリを生成するための設定情報が含まれています。 -
新しく作成した GraphQLGenerated フォルダー内で、GraphQLのタイプを追加または編集します。 例えば、次の内容を含んだ
DynamicBlocks.graphqlタイプを追加できます。code language-graphql query dynamicBlocks($input: DynamicBlocksFilterInput){ dynamicBlocks(input: $input) { items { content { html } } } }
これで、Adobe Experience Platform Mobile SDKがCommerce モバイルアプリと統合されました。 イベントデータは、アプリからExperience Platform Edge に送られます。
-
モバイルアプリケーションから生成されたCommerce イベントを区別する方法
すべての イベント には、channel というフィールドが含まれています。 channel フィールドには、channel._id と channel._type が含まれ、Luma ストアフロントの名前空間の値はそれぞれ "https://ns.adobe.com/xdm/channels/web" と "https://ns.adobe.com/xdm/channel-types/web" です。 ただし、モバイルストアフロントの場合、名前空間の値はそれぞれ "https://ns.adobe.com/xdm/channels/mobile-app" と "https://ns.adobe.com/xdm/channel-types/mobile" です。
次の手順
モバイル Commerce アプリからReal-Time CDP オーディエンスを取得し、買い物かごの価格ルール、動的ブロック、関連する商品ルールを通知する方法については、Audience Activation を参照してください。