將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行動應用程式中的應用程式程式碼中使用的結構描述相同。
商務
完成Experience平台的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環境。
在您的專案組建設定中,新增URL至Commerce GraphQL端點。 例如:
- 偵錯: http://偵錯.commercesite.cloud/graphql/
- 發行版本: http://版本.commercesite.cloud/graphql/
-
若要從Commerce GraphQL端點擷取資料,請先使用在您的專案中產生必要的檔案和目錄 Apollo程式碼產生器.
-
從您的專案目錄, 安裝 阿波羅·iOS。
-
初始化 Apollo Codegen CLI。
這會建立
apollo-codegen-configuration.json
檔案。 -
取代專案中必要的GraphQL檔案和目錄
apollo-codegen-configuration.json
檔案包含下列專案: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
檔案,其中包含用來產生必要檔案和目錄的組態資訊。 -
在新建立的內部 GraphQLGerated 資料夾,新增或編輯GraphQL型別。 例如,您可以新增
DynamicBlocks.graphql
輸入以下內容:code language-graphql query dynamicBlocks($input: DynamicBlocksFilterInput){ dynamicBlocks(input: $input) { items { content { html } } } }
您現在已將Adobe Experience Platform Mobile SDK與Commerce行動應用程式整合。 事件資料會從您的應用程式傳輸至Experience Platform邊緣。
-
如何區分從行動應用程式產生的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.