sseller.tips
Also in English: Switch to English →

Google Merchant Center XML Feed:可用的示例和常见错误

Merchant Center 的 XML 商品 Feed 就是一个普通的 RSS 2.0 文件,只多了一样东西:Google 自己的命名空间(namespace),用来添加价格、库存状态等商品属性。这一个细节写错,Google 就会悄悄忽略你的数据。

完整示例

按照 Google 官方 RSS 2.0 示例的结构,包含一个商品:

<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
  <channel>
    <title>Example Store</title>
    <link>https://www.example.com</link>
    <description>Product feed for Example Store</description>
    <item>
      <g:id>MUG-001</g:id>
      <g:title>Handmade Ceramic Mug, 12 oz, Speckled White</g:title>
      <g:description>Wheel-thrown stoneware mug, dishwasher safe.</g:description>
      <g:link>https://www.example.com/products/ceramic-mug</g:link>
      <g:image_link>https://www.example.com/images/mug-001.jpg</g:image_link>
      <g:condition>new</g:condition>
      <g:availability>in stock</g:availability>
      <g:price>28.00 USD</g:price>
      <g:shipping>
        <g:country>US</g:country>
        <g:service>Standard</g:service>
        <g:price>6.00 USD</g:price>
      </g:shipping>
      <g:gtin>123456789123</g:gtin>
      <g:brand>Example Store</g:brand>
    </item>
  </channel>
</rss>

每个商品一个 <item>。GTIN 换成商品真实的编码;商品没有 GTIN 就删掉这一行。

命名空间:最关键的一行

<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">

使用 Merchant Center 属性必须有这个声明,而且要一字不差。声明之后,每个属性都要带 g: 前缀:

  • <g:price>28.00 USD</g:price>——能识别。
  • <price>28.00 USD</price>——不能识别。Google 说缺少命名空间的属性会产生警告,并且不会被处理。

这就是 “XML missing attribute(XML 缺少属性)” 问题的原因。Feed 里出现这个提示,就检查前缀和文件头那一行。

如果用 Atom 格式,文件头是:

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">

Google 要求什么、忽略什么

  • RSS 2.0 标准里 item 级别的 title、link、description 是可选的,但商品 Feed 要求必须有。
  • 商品 Feed 还要求价格、ID、商品状况(condition)等属性。
  • Google 会忽略其他 RSS 元素和自定义标签——不会报错,但其中的数据不会出现在广告或商品展示里。

完整的属性列表,以及你的商品哪些属性必填,见 Google 的商品数据规范。

上传前检查清单

  1. 文件名以 .xml 结尾。
  2. 文件名和 Merchant Center 里登记的名称一致。
  3. 命名空间声明存在且一字不差。
  4. 每个商品属性都有 g: 前缀。

上传后,逐个检查商品状态有没有问题——见 Google Merchant Center 商品状态。

官方参考资料

Google Merchant Center 是其所有者的商标。seller.tips 是独立网站,与 Google Merchant Center 无关联。