「產品集合」可讓您定義要搭配多種格式使用的產品群組,例如可購物圖片。每個集合最多可以包含 100 項產品。您可以使用 Google Merchant Center 或 Content API 建立產品素材資源集合。
本指南將說明如何透過 Content API 使用產品集合,包括如何為可購物圖片建立集合的範例,以及如何查看集合狀態的範例。
使用產品集合
Content API 提供兩項服務管理產品集合:
collections
:讓您取得、列出、插入及刪除產品集合。collectionstatuses
:可讓您取得並列出集合的狀態,以探索集合是否有任何問題,導致目的地無效 (例如購物廣告)。
範例:為可購物圖片建立產品素材資源集合
可購物圖片是顯示一或多項含註解產品的高畫質圖片,可使用集合進行設定。如要使用可購物圖片,除了所有產品素材資源集合的必填欄位之外,您也必須指定 imageLink
和 featuredProduct
欄位的值。如要進一步瞭解必填欄位,請參閱 Content API 參考說明文件。
如要使用可購物圖片,您必須建立產品系列,並使用 imageLink
欄位指定含有十種產品的圖片。建議您使用正方形圖片 (長寬比為 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"
}
]
}