消息格式

先决条件 — Adobe Experience Platform概念 prerequisites

要了解Adobe端的报文格式以及用户档案配置和转换流程,请熟悉以下Experience Platform概念:

IMPORTANT
Destination SDK支持的所有参数名称和值包括 区分大小写. 为避免出现区分大小写错误,请完全按照文档中的说明使用参数名称和值。

支持的集成类型 supported-integration-types

有关哪些类型的集成支持此页面上描述的功能,请参阅下表。

集成类型
支持功能
实时(流)集成
基于文件(批处理)的集成
是(下面图中仅步骤1和2)

概述 overview

本页介绍从Adobe Experience Platform导出到目标的数据中的消息格式和配置文件转换。

Adobe Experience Platform会以各种数据格式将数据导出到大量目标。 目标类型的一些示例包括广告平台(Google)、社交网络(Facebook)和云存储位置(Amazon S3、Azure事件中心)。

Experience Platform可以调整导出用户档案的消息格式,以与您这边的预期格式匹配。 要了解此自定义设置,请务必了解以下概念:

  • Adobe Experience Platform中的源(1)和目标(2) XDM架构
  • 合作伙伴端的预期消息格式(3),以及
  • XDM架构和预期消息格式之间的转换层,您可以通过创建 消息转换模板.

架构到JSON的转换

Experience Platform使用XDM架构以一致且可重用的方式描述数据结构。

源XDM架构(1):此项目是指客户在Experience Platform中使用的架构。 在Experience Platform中,在 映射步骤 在激活目标工作流中,客户将字段从其XDM架构映射到目标的目标架构(2)。

目标XDM架构(2):根据目标预期格式的JSON标准架构(3)以及目标可以解释的属性,您可以在目标XDM架构中定义配置文件属性和身份。 您可以在目标配置中执行此操作,只需在 schemaConfigidentityNamespaces 对象。

目标配置文件属性的JSON标准架构(3):此示例表示 JSON架构 平台支持的所有配置文件属性及其类型(例如:对象、字符串、数组)。 您的目标可能支持的示例字段包括 firstNamelastNamegenderemailphoneproductIdproductName,等等。 您需要一个 消息转换模板 定制导出为Experience Platform的数据以符合您的预期格式。

根据上述架构转换,下面说明了源XDM架构与合作伙伴端示例架构之间的配置文件配置更改方式:

转换消息示例

快速入门 — 转换三个基本属性 getting-started

为了演示配置文件转换过程,以下示例在Adobe Experience Platform中使用了三个常见的配置文件属性: 名字姓氏、和 电子邮件地址.

NOTE
客户在的Adobe Experience Platform UI中将源XDM架构中的属性映射到合作伙伴XDM架构。 映射 步骤 激活目标工作流.

假设您的平台可以接收如下消息格式:

POST https://YOUR_REST_API_URL/users/
Content-Type: application/json
Authorization: Bearer YOUR_REST_API_KEY

{
  "attributes":
    {
      "first_name": "Yours",
      "last_name": "Truly",
      "external_id": "yourstruly@adobe.com"
    }
}

考虑到报文格式,相应的转换如下:

Adobe端的合作伙伴XDM架构中的属性
转换
您这边HTTP消息中的属性
_your_custom_schema.firstName
attributes.first_name
first_name
_your_custom_schema.lastName
attributes.last_name
last_name
personalEmail.address
attributes.external_id
external_id

Experience Platform中的配置文件结构 profile-structure

要进一步了解页面上下面的示例,请务必了解Experience Platform中用户档案的结构。

配置文件包含3个部分:

  • segmentMembership (始终显示在配置文件中)

    • 此部分包含配置文件中存在的所有受众。 受众可以具有以下两种状态之一: realizedexited.
  • identityMap (始终显示在配置文件中)

    • 此部分包含配置文件中存在的所有身份(电子邮件、Google GAID、Apple IDFA等),以及映射为在激活工作流中导出的用户。
  • 属性(根据目标配置,这些属性可能出现在配置文件中)。 要注意的是,预定义属性和自由格式属性之间也存在一些细微差异:

    • 对象 自由格式属性,这些页面包含 .value 路径(如果属性存在于配置文件中)(请参阅 lastName 属性(示例1)。 如果它们不在配置文件中,则不会包含 .value 路径(请参阅 firstName 属性(示例1)。
    • 对象 预定义属性,这些不包含 .value 路径。 配置文件中存在的所有映射属性都将出现在属性映射中。 不存在的则不存在(请参阅示例2 - firstName 属性在配置文件中不存在)。

请参阅下面两个Experience Platform中配置文件的示例:

示例1,带有 segmentMembershipidentityMap 自由格式属性的和属性 example-1

{
  "segmentMembership": {
    "ups": {
      "11111111-1111-1111-1111-111111111111": {
        "lastQualificationTime": "2019-04-15T02:41:50.000+0000",
        "status": "realized"
      }
    }
  },
  "identityMap": {
    "mobileIds": [
      {
        "id": "e86fb215-0921-4537-bc77-969ff775752c"
      }
    ]
  },
  "attributes": {
    "firstName": {
    },
    "lastName": {
      "value": "lastName"
    }
  }
}

示例2,带有 segmentMembershipidentityMap 预定义属性的和属性 example-2

{
  "segmentMembership": {
    "ups": {
      "11111111-1111-1111-1111-111111111111": {
        "lastQualificationTime": "2019-04-15T02:41:50.000+0000",
        "status": "realized"
      }
    }
  },
  "identityMap": {
    "mobileIds": [
      {
        "id": "e86fb215-0921-4537-bc77-969ff775752c"
      }
    ]
  },
  "attributes": {
    "lastName": "lastName"
  }
}

使用模板语言进行身份、属性和受众成员资格转换 using-templating

Adobe用途 卵石模板,一种类似于的模板化语言 金贾,以将Experience PlatformXDM架构中的字段转换为目标支持的格式。

此部分提供了多个如何进行这些转换的示例 — 从输入XDM模式通过模板,然后输出到目标接受的有效负载格式。 下面的示例通过提高复杂性来显示,如下所示:

  1. 简单转换示例。 了解模板化如何与以下项的简单转换一起使用 配置文件属性受众会员资格、和 标识 字段。
  2. 增加了将以上字段组合在一起的模板的复杂性: 创建用于发送受众和身份的模板创建用于发送区段、身份和配置文件属性的模板.
  3. 包含聚合键的模板。 当您使用 可配置聚合 在目标配置中,Experience Platform根据受众ID、受众状态或身份命名空间等条件对导出到目标的用户档案进行分组。

配置文件属性 attributes

要转换导出到目标的配置文件属性,请参阅下面的JSON和代码示例。

IMPORTANT
有关Adobe Experience Platform中所有可用配置文件属性的列表,请参阅 XDM字段字典.

输入

配置文件1:

{
    "attributes": {
        "firstName": {
            "value": "Hermione"
    },
    "birthDate": {}
  }
}

配置文件2:

{
  "attributes": {
    "firstName": {
      "value": "Harry"
    },
    "birthDate": {
        "value": "1980/07/31"
    }
  }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.
{
    "profiles": [
        {% for profile in input.profiles %}
        {
            {% for attribute in profile.attributes %}
            "{{ attribute.key }}":
                {% if attribute.value is empty %}
                    null
                {% else %}
                    "{{ attribute.value.value }}"
                {% endif %}
            {% if not loop.last %},{% endif %}
            {% endfor %}
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}

结果

{
    "profiles": [
        {
            "firstName": "Hermione",
            "birthDate": null
        },
        {
            "firstName": "Harry",
            "birthDate": "1980/07/31"
        }
    ]
}

受众会员资格 audience-membership

区段成员资格 XDM属性会通知用户档案所属的受众。
对于 status 字段,请阅读相关的文档 受众成员资格详细信息架构字段组.

输入

配置文件1:

{
  "segmentMembership": {
    "ups": {
      "36a51c13-9dd6-4d2c-8aa3-07d785ea5075": {
        "lastQualificationTime": "2019-11-20T13:15:49Z",
        "status": "realized"
      },
      "788d8874-8007-4253-92b7-ee6b6c20c6f3": {
        "lastQualificationTime": "2019-11-20T13:15:49Z",
        "status": "realized"
      },
      "8f812592-3f06-416b-bd50-e7831848a31a": {
        "lastQualificationTime": "2019-11-20T13:15:49Z",
        "status": "exited"
      }
    }
  }
}

配置文件2:

{
  "segmentMembership": {
    "ups": {
      "32396e4b-16f6-4033-9702-fc69b5e24e7c": {
        "lastQualificationTime": "2021-08-20T17:23:04Z",
        "status": "realized"
      },
      "af854278-894a-4192-a96b-320fbf2623fd": {
        "lastQualificationTime": "2021-08-20T16:44:37Z",
        "status": "realized"
      },
      "66505bf9-bc08-4bac-afbc-8b6706650ea4": {
        "lastQualificationTime": "2019-08-20T17:23:04Z",
        "status": "realized"
      }
    }
  }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.
{
    "profiles": [
        {% for profile in input.profiles %}
        {
            "AdobeExperiencePlatformSegments": {
                "add": [
                {% for segment in profile.segmentMembership.ups | added %}
                "{{ segment.key }}"{% if not loop.last %},{% endif %}
                {% endfor %}
                ],
                "remove": [
                {# Alternative syntax for filtering audiences by status: #}
                {% for segment in removedSegments(profile.segmentMembership.ups) %}
                "{{ segment.key }}"{% if not loop.last %},{% endif %}
                {% endfor %}
                ]
            }
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}

结果

{
    "profiles": [
        {
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "36a51c13-9dd6-4d2c-8aa3-07d785ea5075",
                    "788d8874-8007-4253-92b7-ee6b6c20c6f3"
                ],
                "remove": [
                    "8f812592-3f06-416b-bd50-e7831848a31a"
                ]
            }
        },
        {
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "32396e4b-16f6-4033-9702-fc69b5e24e7c",
                    "af854278-894a-4192-a96b-320fbf2623fd",
                    "66505bf9-bc08-4bac-afbc-8b6706650ea4"
                ],
                "remove": [
                ]
            }
        }
    ]
}

标识 identities

有关Experience Platform中标识的信息,请参见 身份命名空间概述.

输入

配置文件1:

{
    "identityMap": {
        "email": [
            {
                "id": "johndoe@example.com"
            },
            {
                "id": "jd@example.com"
            }
        ],
        "external_id": [
            {
                "id": "123456"
            }
        ]
    }
}

配置文件2:

{
    "identityMap": {
        "email": [
            {
                "id": "jane.doe@example.com"
            }
        ]
    }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.
{
    "profiles": [
        {% for profile in input.profiles %}
        {
            "identities": [
                {% for email in profile.identityMap.email %}
                {
                    "type": "email",
                    "id": "{{ email.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}

                {# Add a comma only if you have both emails and external_ids. #}
                {% if profile.identityMap.email is not empty and profile.identityMap.external_id is not empty %}
                    ,
                {% endif %}

                {% for external in profile.identityMap.external_id %}
                {
                    "type": "external_id",
                    "id": "{{ external.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}
            ]
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}

结果

{
    "profiles": [
        {
            "identities": [
                {
                    "type": "email",
                    "id": "johndoe@example.com"
                },
                {
                    "type": "email",
                    "id": "jd@example.com"
                },
                {
                    "type": "external_id",
                    "id": "123456"
                }
            ]
        },
        {
            "identities": [
                {
                    "type": "email",
                    "id": "jane.doe@example.com"
                }
            ]
        }
    ]
}

创建用于发送受众和身份的模板 segments-and-identities

本节提供了AdobeXDM架构与合作伙伴目标架构之间常用转换的示例。
以下示例显示了如何转换受众成员资格和身份格式并将它们输出到您的目标。

输入

配置文件1:

{
    "identityMap": {
        "email": [
            {
                "id": "johndoe@example.com"
            },
            {
                "id": "jd@example.com"
            }
        ],
        "external_id": [
            {
                "id": "123456"
            }
        ]
    },
    "segmentMembership": {
        "ups": {
            "36a51c13-9dd6-4d2c-8aa3-07d785ea5075": {
                "lastQualificationTime": "2019-11-20T13:15:49Z",
                "status": "realized"
            },
            "788d8874-8007-4253-92b7-ee6b6c20c6f3": {
              "lastQualificationTime": "2019-11-20T13:15:49Z",
              "status": "realized"
            },
            "8f812592-3f06-416b-bd50-e7831848a31a": {
                "lastQualificationTime": "2019-11-20T13:15:49Z",
                "status": "exited"
            }
        }
    }
}

配置文件2:

{
    "identityMap": {
        "email": [
            {
                "id": "jane.doe@example.com"
            }
        ]
    },
    "segmentMembership": {
        "ups": {
            "36a51c13-9dd6-4d2c-8aa3-07d785ea5075": {
                "lastQualificationTime": "2021-08-31T10:01:42Z",
                "status": "realized"
            }
        }
    }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.
{
    "profiles": [
        {% for profile in input.profiles %}
        {
            "identities": [
                {% for email in profile.identityMap.email %}
                {
                    "type": "email",
                    "id": "{{ email.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}

                {# Add a comma only if you have both emails and external_ids. #}
                {% if profile.identityMap.email is not empty and profile.identityMap.external_id is not empty %}
                    ,
                {% endif %}

                {% for external in profile.identityMap.external_id %}
                {
                    "type": "external_id",
                    "id": "{{ external.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                    {% for segment in profile.segmentMembership.ups | added %}
                    "{{ segment.key }}"{% if not loop.last %},{% endif %}
                    {% endfor %}
                ],
                "remove": [
                    {# Alternative syntax for filtering audiences by status: #}
                    {% for segment in removedSegments(profile.segmentMembership.ups) %}
                    "{{ segment.key }}"{% if not loop.last %},{% endif %}
                    {% endfor %}
                ]
            }
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}

结果

json 以下表示从Adobe Experience Platform中导出的数据。

{
    "profiles": [
        {
            "identities": [
                {
                    "type": "email",
                    "id": "johndoe@example.com"
                },
                {
                    "type": "email",
                    "id": "jd@example.com"
                },
                {
                    "type": "external_id",
                    "id": "123456"
                }
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "36a51c13-9dd6-4d2c-8aa3-07d785ea5075",
                    "788d8874-8007-4253-92b7-ee6b6c20c6f3"
                ],
                "remove": [
                    "8f812592-3f06-416b-bd50-e7831848a31a"
                ]
            }
        },
        {
            "identities": [
                {
                    "type": "email",
                    "id": "jane.doe@example.com"
                }
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "36a51c13-9dd6-4d2c-8aa3-07d785ea5075"
                ],
                "remove": []
            }
        }
    ]
}

创建用于发送区段、身份和配置文件属性的模板 segments-identities-attributes

本节提供了AdobeXDM架构与合作伙伴目标架构之间常用转换的示例。

另一个常见用例是导出包含受众成员资格、身份(例如:电子邮件地址、电话号码、广告ID)和配置文件属性的数据。 要以这种方式导出数据,请参阅以下示例:

输入

配置文件1:

{
    "attributes": {
        "firstName": {
            "value": "Hermione"
        },
        "birthDate": {}
    },
    "identityMap": {
        "email": [
            {
                "id": "johndoe@example.com"
            },
            {
                "id": "jd@example.com"
            }
        ],
        "external_id": [
            {
                "id": "123456"
            }
        ]
    },
    "segmentMembership": {
        "ups": {
            "36a51c13-9dd6-4d2c-8aa3-07d785ea5075": {
                "lastQualificationTime": "2019-11-20T13:15:49Z",
                "status": "realized"
            },
            "788d8874-8007-4253-92b7-ee6b6c20c6f3": {
              "lastQualificationTime": "2019-11-20T13:15:49Z",
              "status": "realized"
            },
            "8f812592-3f06-416b-bd50-e7831848a31a": {
                "lastQualificationTime": "2019-11-20T13:15:49Z",
                "status": "exited"
            }
        }
    }
}

配置文件2:

{
    "attributes": {
        "firstName": {
            "value": "Harry"
        },
        "birthDate": {
            "value": "1980/07/31"
        }
    },
    "identityMap": {
        "email": [
            {
                "id": "harry.p@example.com"
            }
        ]
    },
    "segmentMembership": {
        "ups": {
            "36a51c13-9dd6-4d2c-8aa3-07d785ea5075": {
                "lastQualificationTime": "2019-11-20T13:15:49Z",
                "status": "realized"
            }
        }
    }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.
{
    "profiles": [
        {% for profile in input.profiles %}
        {
            "attributes": {
            {% for attribute in profile.attributes %}
                "{{ attribute.key }}":
                    {% if attribute.value is empty %}
                        null
                    {% else %}
                        "{{ attribute.value.value }}"
                    {% endif %}
                {% if not loop.last %},{% endif %}
            {% endfor %}
            },
            "identities": [
                {% for email in profile.identityMap.email %}
                {
                    "type": "email",
                    "id": "{{ email.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}

                {# Add a comma only if we have both emails and external_ids. #}
                {% if profile.identityMap.email is not empty and profile.identityMap.external_id is not empty %}
                    ,
                {% endif %}

                {% for external in profile.identityMap.external_id %}
                {
                    "type": "external_id",
                    "id": "{{ external.id }}"
                }{% if not loop.last %},{% endif %}
                {% endfor %}
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                {% for segment in profile.segmentMembership.ups | added %}
                    "{{ segment.key }}"{% if not loop.last %},{% endif %}
                {% endfor %}
                ],
                "remove": [
                {# Alternative syntax for filtering audiences by status: #}
                {% for segment in removedSegments(profile.segmentMembership.ups) %}
                    "{{ segment.key }}"{% if not loop.last %},{% endif %}
                {% endfor %}
                ]
            }
        }
    ]
}

结果

json 以下表示从Adobe Experience Platform中导出的数据。

{
    "profiles": [
        {
            "attributes": {
                "firstName": "Hermione",
                "birthDate": null
            },
            "identities": [
                {
                    "type": "email",
                    "id": "johndoe@example.com"
                },
                {
                    "type": "email",
                    "id": "jd@example.com"
                },
                {
                    "type": "external_id",
                    "id": "123456"
                }
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "36a51c13-9dd6-4d2c-8aa3-07d785ea5075",
                    "788d8874-8007-4253-92b7-ee6b6c20c6f3"
                ],
                "remove": [
                    "8f812592-3f06-416b-bd50-e7831848a31a"
                ]
            }
        },
        {
            "attributes": {
                "firstName": "Harry",
                "birthDate": "1980/07/21"
            },
            "identities": [
                {
                    "type": "email",
                    "id": "harry.p@example.com"
                }
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                    "36a51c13-9dd6-4d2c-8aa3-07d785ea5075"
                ],
                "remove": []
            }
        }
    ]
}

在模板中包含Aggregation Key,以访问按不同条件分组的导出用户档案 template-aggregation-key

当您使用 可配置聚合 在目标配置中,您可以根据受众ID、受众别名、受众成员资格或身份命名空间等条件,对导出到目标的用户档案进行分组。

在消息转换模板中,您可以访问上述聚合键,如以下部分中的示例所示。 使用聚合密钥构造导出为Experience Platform的HTTP消息,以匹配目标所需的格式和速率限制。

在模板中使用受众ID聚合密钥 aggregation-key-segment-id

如果您使用 可配置聚合 并设置 includeSegmentId 如果为true,则导出到目标的HTTP消息中的用户档案将按受众ID分组。 请参阅下文,了解如何在模板中访问受众ID。

输入

请考虑以下四个配置文件,其中:

  • 前两个是具有受众ID的受众的一部分 788d8874-8007-4253-92b7-ee6b6c20c6f3
  • 第三个配置文件是具有受众ID的受众的一部分 8f812592-3f06-416b-bd50-e7831848a31a
  • 第四个配置文件是上述两个受众的一部分。

配置文件1:

{
   "attributes":{
      "firstName":{
         "value":"Hermione"
      }
   },
   "segmentMembership":{
      "ups":{
         "788d8874-8007-4253-92b7-ee6b6c20c6f3":{
            "lastQualificationTime":"2020-11-20T13:15:49Z",
            "status":"realized"
         }
      }
   }
}

配置文件2:

{
   "attributes":{
      "firstName":{
         "value":"Harry"
      }
   },
   "segmentMembership":{
      "ups":{
         "788d8874-8007-4253-92b7-ee6b6c20c6f3":{
            "lastQualificationTime":"2020-11-20T13:15:49Z",
            "status":"realized"
         }
      }
   }
}

配置文件3:

{
   "attributes":{
      "firstName":{
         "value":"Tom"
      }
   },
   "segmentMembership":{
      "ups":{
         "8f812592-3f06-416b-bd50-e7831848a31a":{
            "lastQualificationTime":"2021-02-20T12:00:00Z",
            "status":"realized"
         }
      }
   }
}

配置文件4:

{
   "attributes":{
      "firstName":{
         "value":"Jerry"
      }
   },
   "segmentMembership":{
      "ups":{
         "8f812592-3f06-416b-bd50-e7831848a31a":{
            "lastQualificationTime":"2021-02-20T12:00:00Z",
            "status":"realized"
         },
         "788d8874-8007-4253-92b7-ee6b6c20c6f3":{
            "lastQualificationTime":"2020-11-20T13:15:49Z",
            "status":"realized"
         }
      }
   }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.

请注意以下方式 audienceId 在模板中用于访问受众ID。 此示例假设您使用 audienceId 目标分类中的受众成员资格。 您可以改用任何其他字段名称,具体取决于您自己的分类。

{
    "audienceId": "{{ input.aggregationKey.segmentId }}",
    "profiles": [
        {% for profile in input.profiles %}
        {
            "first_name": "{{ profile.attributes.firstName.value }}"
        }{% if not loop.last %},{% endif %}
        {% endfor %}
    ]
}

结果

将用户档案导出到目标后,会根据其受众ID将其分为两个组。

{
   "audienceId":"788d8874-8007-4253-92b7-ee6b6c20c6f3",
   "profiles":[
      {
         "firstName":"Hermione"
      },
      {
         "firstName":"Harry"
      },
      {
         "firstName":"Jerry"
      }
   ]
}
{
   "audienceId":"8f812592-3f06-416b-bd50-e7831848a31a",
   "profiles":[
      {
         "firstName":"Tom"
      },
      {
         "firstName":"Jerry"
      }
   ]
}

在模板中使用受众别名聚合密钥 aggregation-key-segment-alias

如果您使用 可配置聚合 并设置 includeSegmentId 设置为true时,您还可以访问模板中的受众别名。

将以下行添加到模板,以访问按受众别名分组的导出用户档案。

customerList={{input.aggregationKey.segmentAlias}}

在模板中使用受众状态聚合密钥 aggregation-key-segment-status

如果您使用 可配置聚合 并设置 includeSegmentIdincludeSegmentStatus 设置为true时,您可以访问模板中的受众状态。 这样,您就可以根据是否应从区段中添加或删除用户档案,对导出到目标的HTTP消息中的用户档案进行分组。

可能的值包括:

  • 已实现
  • 现有
  • 已退出

将以下行添加到模板中,根据上述值在区段中添加或删除用户档案:

action={% if input.aggregationKey.segmentStatus == "exited" %}REMOVE{% else %}ADD{% endif%}

在模板中使用身份命名空间聚合密钥 aggregation-key-identity

以下是一个示例, 可配置聚合 在目标配置中,设置为在表单中按身份命名空间聚合导出的配置文件 "namespaces": ["email", "phone"]"namespaces": ["GAID", "IDFA"]. 请参阅 groups 中的参数 创建目标配置 文档,以了解有关分组的更多详细信息。

输入

配置文件1:

{
   "identityMap":{
      "email":[
         {
            "id":"e1@example.com"
         },
         {
            "id":"e2@example.com"
         }
      ],
      "phone":[
         {
            "id":"+40744111222"
         }
      ],
      "IDFA":[
         {
            "id":"AEBE52E7-03EE-455A-B3C4-E57283966239"
         }
      ],
      "GAID":[
         {
            "id":"e4fe9bde-caa0-47b6-908d-ffba3fa184f2"
         }
      ]
   }
}

配置文件2:

{
   "identityMap":{
      "email":[
         {
            "id":"e3@example.com"
         }
      ],
      "phone":[
         {
            "id":"+40744333444"
         },
         {
            "id":"+40744555666"
         }
      ],
      "IDFA":[
         {
            "id":"134GHU45-34HH-GHJ7-K0H8-LHN665998NN0"
         }
      ],
      "GAID":[
         {
            "id":"47bh00i9-8jv6-334n-lll8-nb7f24sghg76"
         }
      ]
   }
}

模板

IMPORTANT
对于使用的所有模板,必须转义非法字符,如双引号 "" 插入之前 模板目标服务器配置. 有关逸出双引号的更多信息,请参见 JSON标准.

请注意 input.aggregationKey.identityNamespaces 在下面的模板中使用

{
            "profiles": [
            {% for profile in input.profiles %}
            {
                {% for ns in input.aggregationKey.identityNamespaces %}
                "{{ns}}": [
                    {% for id in profile.identityMap[ns] %}
                    "{{id.id}}"{% if not loop.last %},{% endif %}
                    {% endfor %}
                ]{% if not loop.last %},{% endif %}
                {% endfor %}
            }{% if not loop.last %},{% endif %}
            {% endfor %}
        ]
}

结果

将用户档案导出到目标时,会根据其身份命名空间将用户档案拆分为两个组。 电子邮件和电话位于一个组中,而GAID和IDFA位于另一个组中。

{
   "profiles":[
      {
         "email":[
            "e1@example.com",
            "e2@example.com"
         ],
         "phone":[
            "+40744111222"
         ]
      },
      {
         "email":[
            "e3@example.com"
         ],
         "phone":[
            "+40744333444",
            "+40744555666"
         ]
      }
   ]
}
{
   "profiles":[
      {
         "IDFA":[
            "AEBE52E7-03EE-455A-B3C4-E57283966239"
         ],
         "GAID":[
            "e4fe9bde-caa0-47b6-908d-ffba3fa184f2"
         ]
      },
      {
         "IDFA":[
            "134GHU45-34HH-GHJ7-K0H8-LHN665998NN0"
         ],
         "GAID":[
            "47bh00i9-8jv6-334n-lll8-nb7f24sghg76"
         ]
      }
   ]
}

在URL模板中使用聚合密钥 aggregation-key-url-template

根据您的用例,您还可以在URL中使用此处描述的聚合键,如下所示:

https://api.example.com/audience/{{input.aggregationKey.segmentId}}

引用:转换模板中使用的上下文和函数 reference

提供给模板的上下文包含 input (此调用中导出的用户档案/数据)和 destination (有关Adobe将数据发送到的目标的数据,对所有配置文件有效)。

下表提供了上述示例中函数的说明。

函数
描述
示例
input.profile
用户档案,表示为 JsonNode. 遵循此页面上进一步提到的合作伙伴XDM架构。
hasSegments
此函数采用命名空间受众ID的映射作为参数。 函数返回 true 如果地图中至少有一个受众(无论其状态如何),并且 false 否则。 您可以使用此函数确定是否对受众映射进行迭代。
hasSegments(input.profile.segmentMembership)
destination.namespaceSegmentAliases
将特定Adobe Experience Platform命名空间中的受众ID映射到合作伙伴系统中的受众别名。
destination.namespaceSegmentAliases["ups"]["seg-id-1"]
destination.namespaceSegmentNames
将特定Adobe Experience Platform命名空间中的受众名称映射到合作伙伴系统中的受众名称。
destination.namespaceSegmentNames["ups"]["seg-name-1"]
destination.namespaceSegmentTimestamps
以UNIX时间戳格式返回创建、更新或激活受众的时间。
  • destination.namespaceSegmentTimestamps["ups"]["seg-id-1"].createdAt:返回带有ID的区段所处的时间 seg-id-1,来自 ups 命名空间,创建时采用UNIX时间戳格式。
  • destination.namespaceSegmentTimestamps["ups"]["seg-id-1"].updatedAt:返回具有ID的受众所处的时间 seg-id-1,来自 ups 命名空间已更新,采用UNIX时间戳格式。
  • destination.namespaceSegmentTimestamps["ups"]["seg-id-1"].mappingCreatedAt:返回具有ID的受众所处的时间 seg-id-1,来自 ups 命名空间中,已以UNIX时间戳格式激活到目标。
  • destination.namespaceSegmentTimestamps["ups"]["seg-id-1"].mappingUpdatedAt:以UNIX时间戳格式返回目标上更新受众激活的时间。
addedSegments(mapOfNamespacedSegmentIds)
仅返回具有状态的受众 realized,跨所有命名空间。
addedSegments(input.profile.segmentMembership)
removedSegments(mapOfNamespacedSegmentIds)
仅返回具有状态的受众 exited,跨所有命名空间。
removedSegments(input.profile.segmentMembership)
destination.segmentAliases
已弃用。 替换为destination.namespaceSegmentAliases

从Adobe Experience Platform命名空间中的受众ID映射到合作伙伴系统中的受众别名。
destination.segmentAliases["seg-id-1"]
destination.segmentNames
已弃用。 替换为destination.namespaceSegmentNames

将Adobe Experience Platform命名空间中的受众名称映射到合作伙伴系统中的受众名称。
destination.segmentNames["seg-name-1"]
destination.segmentTimestamps
已弃用。 替换为destination.namespaceSegmentTimestamps

以UNIX时间戳格式返回创建、更新或激活受众的时间。
  • destination.segmentTimestamps["seg-id-1"].createdAt:返回具有ID的受众所处的时间 seg-id-1 创建时间,格式为UNIX时间戳。
  • destination.segmentTimestamps["seg-id-1"].updatedAt:返回具有ID的受众所处的时间 seg-id-1 更新了,采用UNIX时间戳格式。
  • destination.segmentTimestamps["seg-id-1"].mappingCreatedAt:返回具有ID的受众所处的时间 seg-id-1 已以UNIX时间戳格式激活到目标。
  • destination.segmentTimestamps["seg-id-1"].mappingUpdatedAt:以UNIX时间戳格式返回目标上更新受众激活的时间。

后续步骤 next-steps

阅读本文档后,您现在知道如何转换从Experience Platform导出的数据。 接下来,请阅读以下页面,以了解有关为目标创建消息转换模板的知识:

要了解有关其他目标服务器组件的更多信息,请参阅以下文章:

recommendation-more-help
7f4d1967-bf93-4dba-9789-bb6b505339d6