Adobe Experience Platform Mobile SDKとCommerceの統合

IMPORTANT
Adobe Experience Platform Mobile SDK iOS版は、iOS 11以降をサポートしています。

Adobe Experience Platform モバイル SDKをCommerce モバイルアプリと統合すると、マーチャントはCommerce ​ イベントデータ ​をExperience Platform エッジに送信できます。

Commerce イベントデータがエッジで利用可能な場合、他のAdobe Experience Cloud アプリケーションからアクセスできます。 例えば、データを使用してReal-Time CDPでオーディエンスを作成し、それらのオーディエンス ​を使用してCommerce モバイルアプリをパーソナライズできます。

設定

Adobe Experience Platform Mobile SDKとCommerceの使用を開始するには、Experience PlatformにSDKをインストールして設定します。 次に、Commerceで設定を確定します。

Experience Platform

  1. モバイルアプリの機能について詳しくは、​ モバイルアプリのAdobe Experience Cloud チュートリアル ​を参照してください。

  2. Experience PlatformにSDKをインストールして設定します。

    note
    NOTE
    Experience Platformで作成および設定するスキーマは、Commerce モバイルアプリのアプリケーションコードで使用するスキーマと同じです。

Commerce

Experience PlatformのSDK設定を完了したら、SDK設定をCommerceに追加します。

  1. Commerce イベントデータをSDK経由でExperience Platformに送信するには、アプリケーションコードにXDM スキーマを指定する必要があります。 このスキーマは、Experience PlatformのSDKのスキーマ configuredと一致する必要があります。

    次の例は、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)
    
  2. Commerce Cloudとの連携。

    プロジェクトのビルド設定で、Commerce GraphQL エンドポイントにURLを追加します。 例:

    • デバッグ:http://debug.commercesite.cloud/graphql/
    • リリース:http://release.commercesite.cloud/graphql/
  3. Commerce GraphQL エンドポイントからデータを取得するには、まずApollo Code Generatorを使用して、プロジェクトに必要なファイルとディレクトリを生成します。

    1. プロジェクト ディレクトリから、install Apollo iOSをインストールします。

    2. Apollo Codegen CLIを初期化

      これでapollo-codegen-configuration.json ファイルが作成されます。

    3. 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"
      }
      }
      
    4. Commerce GraphQL スキーマを取得します。

      Commerce GraphQL スキーマへの参照を含む./apollo-codegen-config.json ファイルへのパスであることを確認します。

    5. ​ ソースコードを生成します。

      必要なファイルとディレクトリを生成するための構成情報を含む./apollo-codegen-config.json ファイルへのパスであることを確認します。

    6. 新しく作成した​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._idchannel._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を参照してください。

recommendation-more-help
commerce-help-data-connection