商品集可让您 定义一组商品,以便与购物图片等富媒体格式搭配使用,例如 购物图片。每个商品集最多可包含 100 件商品。您可以使用 Google Merchant Center 或 Content API 创建商品集。
本指南介绍了如何通过 Content API 使用商品集,包括如何为购物图片创建商品集以及如何查看商品集状态的示例。
使用商品集
Content API 包含两个用于管理商品集的服务:
collections:可让您获取、列出、插入和删除商品集。collectionstatuses:可让您获取和列出商品集的状态,以 了解商品集是否存在可能导致商品集在 购物广告等目标平台中失效的问题。
示例:为购物图片创建商品集
购物图片是一种高质量图片,用于展示一种或多种带注释的商品,并且使用商品集进行配置。如需使用购物图片,除了所有商品集都必须提供的字段之外,您还必须为 imageLink 和 featuredProduct 字段指定值。如需详细了解必填字段,请参阅
Content API 参考文档。
如需使用购物图片,您必须创建一个商品集,并使用 imageLink 字段指定一张包含最多 10 件商品的图片。我们建议使用方形图片(宽高比为 1:1)。
您还必须使用 featuredProduct 字段指定图片中显示的商品,包括使用 x 和 y 字段指定商品在图片中的坐标。这些字段仅适用于与购物图片搭配使用的商品集。x 和 y 值必须介于 0 和 1 之间(含 0 和 1)。
每个商品集最多可包含 100 件商品。不过,对于购物图片,我们建议您为每张图片指定不超过 10 件商品的坐标,以确保图片上有足够的空间来显示商品宣传信息。 作为 featuredProduct 对象一部分的
offerId
字段必须与 products 资源中的 offerId
值一致,这与 products 资源中的
id值
不同。
除了购物图片必须提供的 imageLink 和 featuredProduct 字段之外,您还可以使用可选的 headline 字段指定商品集标题。我们建议您添加标题,以便为客户提供有关商品集的更多详细信息。
如需为购物图片创建新的商品集,请使用以下网址和请求正文向 collections.insert 端点发出 POST 请求:
https://shoppingcontent.googleapis.com/content/v2.1/merchantId/collections
{
"id": "exampleCollection"
"language": "en",
"productCountry": "UK",
"imageLink": ["www.imageLink.example"],
"featuredProduct": [
{
"offerId": '432',
"x": 0.11,
"y": 0.99
},
{ "offerId": '433',
"x": 0.53,
"y": 0.89
}
],
"link": "www.link.example",
"mobileLink": "www.mobileLink.example",
"headline": "www.link.example",
"customLabel0": "Organize",
"customLabel1": "Your",
"customLabel2": "Bidding/Reporting",
"customLabel3": "With",
"customLabel4": "Me"
}
示例:查看商品集的状态
如需了解您在上面创建的商品集是否存在会导致商品集无法投放广告的问题,请使用以下网址向 collectionsstatuses.get 端点发出 GET 请求,并添加您要检索其状态的商品集的 id。您无需提供请求正文。
https://shoppingcontent.googleapis.com/content/v2.1/merchantID/collectionstatuses/collection ID
商品集状态响应示例
{
"id": "exampleCollection",
"creationDate": "2020-09-22T00:26:51Z",
"lastUpdateDate": "2020-09-22T00:26:51Z",
"collectionLevelIssues": [
{
"code": "invalid_url",
"servability": "unaffected",
"resolution": "merchant_action",
"attributeName": "link",
"description": "Invalid URL [link]",
"detail": "Use a complete URL that starts with http:// or https:// and
links to a valid destination such as an image or a landing page",
"documentation": "https://support.google.com/merchants/answer/7052112"
},
{
"code": "invalid_url",
"servability": "unaffected",
"resolution": "merchant_action",
"attributeName": "imageLink",
"description": "Invalid URL [imageLink]",
"detail": "Use a complete URL that starts with http:// or https:// and
links to a valid destination such as an image or a landing page",
"documentation": "https://support.google.com/merchants/answer/7052112"
}
]
}