用例:使用自定义操作在Experience Platform中写入历程事件 custom-action-aep
此用例说明了如何使用自定义操作和经过身份验证的调用,从历程将自定义事件写入Adobe Experience Platform。
配置IO项目 custom-action-aep-IO
-
在Adobe Developer Console中,单击 项目 并打开您的IO项目。
-
在 凭据 部分中,单击 OAuth服务器到服务器。
-
单击 查看cURL命令。
-
复制cURL命令并存储client_id、client_secret、grant_type和scope。
curl -X POST 'https://ims-na1.adobelogin.com/ims/token/v3' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=client_credentials&client_id=1234&client_secret=5678&scope=openid,AdobeID,read_organizations,additional_info.projectedProductContext,session'
使用HTTP API入口配置Source
-
在Adobe Experience Platform中创建端点以写入历程中的数据。
-
在Adobe Experience Platform中,单击左侧菜单中的 连接 下的 源。 在 HTTP API 下,单击 添加数据。
-
选择 新帐户 并启用身份验证。 单击 连接到Source。
-
单击 下一步 并选择要将数据写入的数据集。 单击 下一步 和 完成。
-
打开新创建的数据流。 复制架构有效负载并将其保存在记事本中。
{
"header": {
"schemaRef": {
"id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>",
"contentType": "application/vnd.adobe.xed-full+json;version=1.0"
},
"imsOrgId": "<org_id>",
"datasetId": "<dataset_id>",
"source": {
"name": "Custom Journey Events"
}
},
"body": {
"xdmMeta": {
"schemaRef": {
"id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>",
"contentType": "application/vnd.adobe.xed-full+json;version=1.0"
}
},
"xdmEntity": {
"_id": "test1",
"<your_org>": {
"journeyVersionId": "",
"nodeId": "", "customer_Id":""
},
"eventMergeId": "",
"eventType": "",
"producedBy": "self",
"timestamp": "2018-11-12T20:20:39+00:00"
}
}
}
配置自定义操作 custom-action-config
在此页面中详细描述了自定义操作配置。
对于此示例,请按照以下步骤操作:
-
打开Adobe Journey Optimizer,然后单击左侧菜单中 管理 下的 配置。 在 操作 下,单击 管理,然后单击 创建操作。
-
设置URL并选择Post方法。
https://dcs.adobedc.net/collection/<collection_id>?syncValidation=false
-
确保配置标头(Content-Type、Charset、sandbox-name)。
设置身份验证 custom-action-aep-authentication
-
使用以下有效负载选择 Type 作为 Custom。
-
粘贴client_secret、client_id、scope和grant_type(来自以前使用的IO项目有效负载)。
code language-none { "type": "customAuthorization", "authorizationType": "Bearer", "endpoint": "https://ims-na1.adobelogin.com/ims/token/v3", "method": "POST", "headers": {}, "body": { "bodyType": "form", "bodyParams": { "grant_type": "client_credentials", "client_secret": "********", "client_id": "<client_id>", "scope": "openid,AdobeID,read_organizations,additional_info.projectedProductContext,session" } }, "tokenInResponse": "json://access_token", "cacheDuration": { "duration": 28000, "timeUnit": "seconds" } }
-
使用 单击测试身份验证 按钮测试连接。
设置有效负载 custom-action-aep-payload
-
在 请求 和 响应 字段中,粘贴以前使用的源连接中的有效负载。
code language-none { "xdmMeta": { "schemaRef": { "id": "https://ns.adobe.com/<your_org>/schemas/<schema_id>", "contentType": "application/vnd.adobe.xed-full+json;version=1.0" } }, "xdmEntity": { "_id": "/uri-reference", "<your_org>": { "journeyVersionId": "Sample value", "nodeId": "Sample value", "customer_Id":"" }, "eventMergeId": "Sample value", "eventType": "advertising.completes, "producedBy": "self", "timestamp": "2018-11-12T20:20:39+00:00" } }
-
将动态填充的字段的字段配置从 常量 更改为 变量。
-
保存自定义操作。
历程
-
最后,在历程中使用此自定义操作编写自定义历程事件。
-
根据您的用例填充历程版本ID、节点ID、节点名称和其他属性。