產品素材資源集合

產品集合可讓您定義產品群組,以便搭配多媒體格式使用,例如可購物圖片。每個產品素材資源集合最多可以包含 100 項產品。你可以使用 Google Merchant Center 或 Content API 建立集合。

本指南說明如何透過 Content API 使用產品集合,包括如何建立可購物圖片的集合,以及如何查看集合狀態的範例。

使用產品集合

Content API 包含兩項服務,可管理產品集合:

  • collections:可讓您取得、列出、插入及刪除產品集合。

  • collectionstatuses:可讓您取得及列出集合的狀態,瞭解集合是否有任何問題,導致集合對目的地無效,例如購物廣告

範例:建立可購物圖片的產品素材資源集合

可購物圖片是高畫質圖片,顯示一或多個附有註解的產品,並使用產品素材資源集合進行設定。如要使用可購物圖片,除了所有集合都必須填寫的欄位外,您也必須為 imageLinkfeaturedProduct 欄位指定值。如要進一步瞭解必填欄位,請參閱Content API 參考說明文件

如要使用可購物圖片,請建立產品集合,並使用 imageLink 欄位指定最多包含十項產品的圖片。建議使用正方形圖片 (顯示比例為 1:1)。

你還必須使用 featuredProduct 欄位指定圖片中顯示的產品,包括使用 xy 欄位指定圖片中產品的座標。只有用於可購物圖片的產品素材資源集合才需要填寫這些欄位。xy 值必須介於 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"
}

示例:查看集合的狀態

如要瞭解您建立的集合是否有問題,導致集合無法放送廣告,請使用下列網址向 GET 端點發出 collectionsstatuses.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"
    }
  ]
}