[PaaS のみ]{class="badge informative" title="Adobe Commerce on Cloud プロジェクト(Adobeが管理する PaaS インフラストラクチャ)およびオンプレミスプロジェクトにのみ適用されます。"}

Adobe Experience Platform Mobile SDKとCommerceの統合

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

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

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

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

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

Commerce

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

  1. 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)
    
  2. をCommerce Cloud環境に接続します。

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

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

    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 スキーマ。

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

    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
1dd1eb92-da61-46c0-8ff9-3831f21eb23e