商品集合

借助商品集合,您可以定义要以丰富格式搭配使用的商品组,例如购物图片。每个集合最多可包含 100 件商品。您可以使用 Google Merchant Center 或 Content API 创建集合。

本指南介绍了如何通过 Content API 使用商品集合,其中包括有关如何为购物图片创建集合以及如何查看集合状态的示例。

使用商品集合

Content API 包含两项服务来管理商品集合:

  • collections:用于获取、列出、插入和删除商品集合。

  • collectionstatuses:可让您获取和列出集合的状态,以发现集合是否存在任何可能导致集合不适用于购物广告平台的问题。

示例:为购物图片创建集合

购物图片是一种高质量图片,会显示一种或多种带注释的商品,并使用集合进行配置。要使用购物图片,除了所有合集必需的字段外,您还必须指定 imageLinkfeaturedProduct 字段的值。如需详细了解必填字段,请参阅 Content API 参考文档

如需使用购物图片,您必须创建一个商品集合,并使用 imageLink 字段指定一张最多包含 10 个商品的图片。建议使用方形图片(宽高比为 1:1)。

您还必须使用 featuredProduct 字段指定图片中显示的商品,包括使用 xy 字段指定图片中商品的坐标。只有与购物图片一起使用的合集时,才需要填写这些字段。xy 值必须介于 0 和 1 之间(含 0 和 1)。

每个集合最多可包含 100 件商品。但是,对于购物图片,我们建议您为每张图片指定的坐标不要超过 10 个,以确保图片上有足够的空间显示商品宣传信息。featuredProduct 对象中的 offerId 字段必须与 products 资源上的 offerId 值匹配,而该值不同于 products 资源上的 id 值。

除了购物图片所需的 imageLinkfeaturedProduct 字段外,您还可以使用可选的 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"
    }
  ]
}