向商家显示问题和解决方案

本指南介绍了第三方应用开发者如何使用 MerchantSupport 服务为其商家创建应用内诊断页面。

您可以使用此服务创建类似于 Merchant Center 帐号诊断产品问题页面的界面。

MerchantSupport 服务仅适用于第三方界面。请求应在商家与应用界面进行交互时触发。如需自动诊断您自己的商家帐号,请参阅帐号状态商品状态商品过滤指南。

我们建议您在应用中提供以下页面,以便您的商家排查问题:

  • 账号诊断
  • 产品诊断

实现诊断页面的不同选项

您可以通过不同的方式实施诊断页面。根据您的需要,选择用于确定复杂诊断操作的处理方式的选项。在请求中,您可以将 user_input_action_option 设置为以下选项之一:

  • REDIRECT_TO_MERCHANT_CENTER:这是默认选项。需要显示额外内容或从商家接收其他输入内容的操作并未在您的应用中完全实现。对于此类操作,API 会提供一个链接,用于重定向到 Merchant Center 中商家可执行操作的相应页面。

  • BUILT_IN_USER_INPUT_ACTIONS:您可以以应用内解决方案的形式实现需要用户输入的复杂操作。

实现诊断页面

本部分介绍了如何实现诊断页面。它使用默认(简单)选项来处理复杂的操作,例如重定向到 Merchant Center。

有关针对应用内操作的更高级实现,请查看以下部分并参阅利用用户输入实现内置操作

实现

以下是我们建议的诊断页面流程:

  1. 商家在您的应用中打开诊断页面。
  2. 您的应用通过调用 MerchantSupport 服务来请求诊断。

    下面是一个示例请求:

    POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/merchantsupport/renderaccountissues?timeZone=America/Los_Angeles&languageCode=en-GB {}
    

    {merchantId} 替换为要为其触发操作处理的帐号的唯一标识符。

  3. 您的应用会显示对商家的响应提供的诊断信息和建议的操作。以下是示例响应:

    {
      "issues": [
        {
          "title": "Misrepresentation",
          "impact": {
            "message": "Prevents all products from showing in all countries",
            "severity": "ERROR",
            "breakdowns": [
              {
                "regions": [
                  {
                    "code": "001",
                    "name": "All countries"
                  }
                ],
                "details": [
                  "Products not showing organically"
                ]
              }
            ]
          },
          "prerenderedContent": "\u003cdiv class=\"issue-detail\"\u003e\u003cdiv class=\"issue-content\"\u003e\u003cp class=\"content-element\"\u003e\u003cspan class=\"segment\"\u003eBased on the information available about your business, there is reason to believe that customers are being misled on Google. Review the Misrepresentation policy and make changes to your Merchant Center and/or online store.u003c/span\u003e\u003c/p\u003e\u003cp class=\"content-element root-causes-intro\"\u003e\u003cspan class=\"segment\"\u003eMake sure your Merchant Center and online store follow the following best practices / guidelines\u003c/span\u003e\u003c/p\u003e\u003cul class=\"content-element root-causes\"\u003e\u003cli\u003e\u003cp\u003e\u003cspan class=\"segment\"\u003eProvide transparency about your business identity, business model, policies and how your customers can interact with you\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003cspan class=\"segment\"\u003ePromote your online reputation by showing reviews or highlighting any badges or seals of approval\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eUse a professional design for your online store that includes an SSL certificate\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eMake sure it's accessible for all users without any redirects and doesn't have any placeholders for text and images.u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eProvide information in the business information settings in your Merchant Center\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eLink any relevant third-party platforms to your Merchant Center and create a Google Business Profile.u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003cspan class=\"segment\"\u003eFollow SEO guidelines, improve your eligibility for seller ratings and match your product data in your Merchant Center with your online store\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003ca href=\"https://support.google.com/merchants/answer/6150127?hl=en-US\" class=\"content-element\"\u003eLearn more about the Misrepresentation policy\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e",
          "actions": [
            {
              "externalAction": {
                "type": "REVIEW_ACCOUNT_ISSUE_IN_MERCHANT_CENTER",
                "uri": "https://merchants.google.com/mc/products/diagnostics/accountissues?a=672911686&hl=en-US"
              },
              "buttonLabel": "Request review",
              "isAvailable": true
            }
          ]
        },
        {
          "title": "Adult-oriented content",
          "impact": {
            "message": "Prevents all products from showing in all countries",
            "severity": "ERROR",
            "breakdowns": [
              {
                "regions": [
                  {
                    "code": "001",
                    "name": "All countries"
                  }
                ],
                "details": [
                  "Products not showing organically"
                ]
              }
            ]
          },
          "prerenderedContent": "\u003cdiv class=\"issue-detail\"\u003e\u003cdiv class=\"callout-banners\"\u003e\u003cdiv class=\"callout-banner callout-banner-info\"\u003e\u003cp\u003e\u003cspan class=\"segment\"\u003eReview requested on Aug 9, 2023. It can take a few days to complete.u003c/span\u003e\u003c/p\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\"issue-content\"\u003e\u003cp class=\"content-element\"\u003e\u003cspan class=\"segment\"\u003eThere was a problem identified with the sale of prohibited adult products on your online store. In the case that you are intentionally selling adult items, enable Adult content in Settings in your Merchant Center. In your product file, use the \u003c/span\u003e\u003cspan class=\"segment segment-attribute\"\u003eadult\u003c/span\u003e\u003cspan class=\"segment\"\u003e attribute for specific products.u003c/span\u003e\u003c/p\u003e\u003cp class=\"content-element root-causes-intro\"\u003e\u003cspan class=\"segment\"\u003eMake sure the products meet the policy requirements\u003c/span\u003e\u003c/p\u003e\u003cul class=\"content-element root-causes\"\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eAdult oriented content may be prohibited or restricted depending on the product sold and the country it is sold\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eSee a full list of countries in the HelpCenter\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eDon't list sexually explicit content that is intended to arouse or includes content such as text, image, audio, or video of graphic sexual acts intended to arouse\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eExamples: Graphic depictions of sexual acts in progress, including hardcore pornography, any type of genital, anal, or oral sexual activity; graphic depictions of masturbation or genital arousal and language explicitly referencing arousal, masturbation, cartoon porn, or hentai\u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003ca href=\"https://support.google.com/merchants/answer/6150138?hl=en-US#wycd-restricted-adult-content\" class=\"content-element\"\u003eLearn more about the Adult-oriented content policy\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e"
        },
        {
          "title": "Missing return and refund policy",
          "impact": {
            "message": "Limits visibility of all products in all countries",
            "severity": "ERROR",
            "breakdowns": [
              {
                "regions": [
                  {
                    "code": "001",
                    "name": "All countries"
                  }
                ],
                "details": [
                  "Limited visibility for products showing organically"
                ]
              }
            ]
          },
          "prerenderedContent": "\u003cdiv class=\"issue-detail\"\u003e\u003cdiv class=\"issue-content\"\u003e\u003cp class=\"content-element\"\u003e\u003cspan class=\"segment\"\u003eThere was a problem identified with the return and/or refund policy of your online store. Update your return or refund policy to provide customers a transparent shopping experience.u003c/span\u003e\u003c/p\u003e\u003cp class=\"content-element root-causes-intro\"\u003e\u003cspan class=\"segment\"\u003eMake sure your products meet the Shopping policy requirements\u003c/span\u003e\u003c/p\u003e\u003cul class=\"content-element root-causes\"\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eIt's available on your online store\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eWe recommend that you have a separate landing page for your policy and link to it from the other pages on your online store, so that it's easy to find.u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp class=\"tooltip tooltip-style-info\"\u003e\u003cspan class=\"segment\"\u003eIt's available in the language of the country you're selling in or in English\u003c/span\u003e\u003cspan class=\"tooltip-icon\"\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"tooltip-text\"\u003e\u003cspan class=\"segment\"\u003eMake sure that the return and/or refund policy is available in the target language or in English. Ideally, users should be given the option to select the return and/or refund policy in their own language.u003c/span\u003e\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003cli\u003e\u003cp\u003e\u003cspan class=\"segment\"\u003eIt's accessible to everyone visiting your online store, without having to log in, sign up or enter any personal information\u003c/span\u003e\u003c/p\u003e\u003c/li\u003e\u003c/ul\u003e\u003ca href=\"https://support.google.com/merchants/answer/9158778?hl=en-US\" class=\"content-element\"\u003eLearn more about Missing return and refund policy\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e",
          "actions": [
            {
              "externalAction": {
                "type": "REVIEW_ACCOUNT_ISSUE_IN_MERCHANT_CENTER",
                "uri": "https://merchants.google.com/mc/products/diagnostics/accountissues?a=672911686&hl=en-US"
              },
             "buttonLabel": "Request review",
             "isAvailable": true
            }
          ]
        }
      ],
      "alternateDisputeResolution": {
        "uri": "https://support.google.com/european-union-digital-services-act-redress-options?hl=en-US",
        "label": "Additional options available to you"
      }
    }
    

    我们建议您使用 titleimpact.message 按问题返回顺序来显示问题。此外,我们还建议您在商家将鼠标悬停在问题标题或问题说明上时,显示问题的 impact.breakdowns

  4. 商家点击列表中的某个问题。

  5. 您的应用会根据 countrydestinationprerendered_content 以及商家可以用来解决问题的 actions 按钮,显示每个问题的详细 impact。有多种不同的操作类型:

    1. 外部操作:指向外部页面(例如 Merchant Center 中的页面),商家可以在其中解决问题。
    2. 内置简单操作:指向应用中商家可在其解决问题的页面。
    3. 内置的用户输入操作:打开一个对话框,商家可以在其中提供所需信息并请求操作。只有在请求 BUILT_IN_USER_INPUT_ACTIONS 时,这种类型的操作才可用。
  6. 商家按照说明解决问题。

  7. 商家会在您的应用中重新加载诊断页面。

  8. 应用向 MerchantSupport 服务再次提交请求,并显示更新后的问题列表。

您可以将已完成的应用显示的信息与 Merchant Center 中的诊断页面进行比较,以验证实现。

界面模拟

以下示例说明了如何在帐号诊断页面中显示 renderaccountissues 响应中的信息。界面中的对象会映射到模拟中的相应 API 字段。您可以针对产品问题创建一个类似的页面

图片

填充的账号诊断页面如下所示:

图片

设置预呈现的 HTML 的样式

调用 MerchantSupport 服务的响应包含 prerendered_content 字段,该字段以 HTML 格式提供每个问题的详细信息。您可以将此 HTML 内容直接嵌入到界面中,以方便阅读的格式显示问题。

您可能会看到类为 new-element 的 HTML 元素。new-element 类适用于在与 MerchantSupport 服务集成后添加到 HTML 中的元素。建议使用 new-element 类隐藏元素,以便在将这些元素显示给应用中的用户之前设置其样式。

以下是 prerendered_content 字段值的示例:

<div class="issue-detail">
  <div class="callout-banners">
    <div class="callout-banner callout-banner-info"><p><span class="segment">Review requested on Aug 9, 2023. It can take a few days to complete.</span>
    </p></div>
  </div>
  <div class="issue-content"><p class="content-element"><span class="segment">There was a problem identified with the sale of prohibited adult products on your online store. In the case that you are intentionally selling adult items, enable Adult content in Settings in your Merchant Center. In your product file, use the </span><span
      class="segment segment-attribute">adult</span><span class="segment"> attribute for specific products.</span>
  </p>
    <p class="content-element root-causes-intro"><span class="segment">Make sure the products meet the policy requirements</span>
    </p>
    <ul class="content-element root-causes">
      <li><p class="tooltip tooltip-style-info"><span class="segment">Adult oriented content may be prohibited or restricted depending on the product sold and the country it is sold</span><span
          class="tooltip-icon"><br></span><span class="tooltip-text"><span class="segment">See a full list of countries in the HelpCenter</span></span>
      </p></li>
      <li><p class="tooltip tooltip-style-info"><span class="segment">Don't list sexually explicit content that is intended to arouse or includes content such as text, image, audio, or video of graphic sexual acts intended to arouse</span><span
          class="tooltip-icon"><br></span><span class="tooltip-text"><span class="segment">Examples: Graphic depictions of sexual acts in progress, including hardcore pornography, any type of genital, anal, or oral sexual activity; graphic depictions of masturbation or genital arousal and language explicitly referencing arousal, masturbation, cartoon porn, or hentai</span></span>
      </p></li>
    </ul>
    <a href="https://support.google.com/merchants/answer/6150138?hl=en-US#wycd-restricted-adult-content"
       class="content-element">Learn more about the Adult-oriented content policy</a></div>
</div>

如果您在应用中嵌入了上述 HTML prerendered_content,而未进行任何样式设置,则如下所示:

图片

您可以使用多个 CSS 类来调整内容在界面中的呈现方式。以下是您可以使用的 CSS 示例:

issue-detail {
  text-align: left;
  width: 700px;
  border-radius: 8px;
  background: white;
  margin: 16px;
  padding: 16px;
}

.content-element {
  margin: 8px 0 8px 0;
  display: block;
}

/* callout banners */
.callout-banners {
  margin: 0 0 16px 0;
}

.callout-banner {
  display: block;
  padding: 16px 16px 6px 16px;
  margin: 0 0 8px 0;
  border-radius: 8px;
}

.callout-banner-info {
  background: #e8f0fe;
}

.callout-banner-warning {
  background: #fef7e0;
}

.callout-banner-error {
  background: #fce8e6;
}

/* add an icon to the callout banner */
.callout-banner p {
  background-repeat: no-repeat;
  padding-left: 32px;
}

.callout-banner-error p {
  background-image: url("https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/error/default/20px.svg");
}

.callout-banner-warning p {
  background-image: url("https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/warning/default/20px.svg");
}

.callout-banner-info p {
  background-image: url("https://fonts.gstatic.com/s/i/short-term/release/googlesymbols/search/default/20px.svg");
}

/* segments with style */
.segment-attribute {
  color: #198639;
  font-family: monospace, monospace;
}

.segment-bold {
  font-weight: bold;
}

.segment-italic {
  font-style: italic;
}

/* tooltip */
.tooltip {
  position: relative;
}

.tooltip-style-info .tooltip-icon:before {
  content: '(i)';
  font-style: normal;
  font-weight: normal;
  text-decoration: inherit;
  margin-left: 5px;
}

.tooltip-style-question .tooltip-icon:before {
  content: '(?)';
  font-style: normal;
  font-weight: normal;
  text-decoration: inherit;
  margin-left: 5px;
}

.tooltip .tooltip-text {
  visibility: hidden;
  text-align: left;
  background: white;
  border-radius: 8px;
  padding: 5px 0;
  border: 1px solid;
  padding: 10px;
  box-shadow: 3px 7px 12px #c1c1c1;
  position: absolute;
  z-index: 1;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
}

/* table */
table.content-element {
  margin: 16px 0 16px 0;
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 1em 0;
}

table.content-element th {
  background-color: #eee;
}

table.content-element th, table td {
  border: 1px solid #ddd;
  font-size: 0.9em;
  padding: 0.3em 1em;
}

/* hidde elements added in future, until they are supported in your application */
.new-element {
  visibility: hidden;
}

如果您使用上述 CSS,所渲染内容将如下所示:

图片

您还可以使用 CSS 配置和显示提示:

图片

通过用户输入实现内置操作

借助包含用户输入的内置操作,您可以以应用内解决方案的形式提供复杂的诊断功能。我们建议以对话框的形式实现,让商家可以提供输入信息、阅读更多信息并确认请求。

每个操作包含一个或多个操作流程。对于某些操作,可以有多个数据流。例如,如果商家因不认同决定而要求进行额外的审核,可能会存在不同的流程;而在已经解决问题的情况下,则可能会有不同的流程。

如需请求数据以使用用户输入来实现复杂操作,您必须将 user_input_action_option 字段设置为 BUILT_IN_USER_INPUT_ACTIONS 值。

POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/merchantsupport/renderaccountissues

{
  "user_input_action_option": "BUILT_IN_USER_INPUT_ACTIONS"
}

{merchantId} 替换为要为其触发操作处理的帐号的唯一标识符。

实现

我们建议请求用户输入的诊断页面流程应如下所示:

  1. 商家点击操作按钮。

    • 如果有多个可用的流程,您的应用会提供所有流程,以便商家根据其意图选择一个流程。
    • 由商家选择该流程。
  2. 您的应用会显示所选操作流程的标题、消息、宣传信息和用户输入表单。我们建议您在一个对话框中显示这些详细信息。

    • 宣传信息(如果存在)包含重要信息,旨在帮助商家更好地了解操作的工作原理以及需要采取哪些措施才能成功。我们建议您突出显示此消息,并根据标注的严重程度设置其样式。
    • 如果流程中有任何输入字段,则需要显示这些字段,以便商家提供值。如果输入字段标记为 required,则您的应用不应允许商家在提供值之前发送请求。
  3. 商家会读取该信息并提供请求的值。

  4. 商家点击相应按钮来确认其请求。

  5. 您的应用会通过调用 MerchantSupport 服务来触发操作的处理。下面是一个示例请求:

    POST https://shoppingcontent.googleapis.com/content/v2.1/{merchantId}/merchantsupport/triggeraction
    
    {
      actionContext: "ActionContextValue=",
      actionInput: { actionFlowId: "flow1",
      inputValues: [
      { input_field_id: "input1", checkbox_input_value: { value: true } }
      ]
    }
    

    {merchantId} 替换为要为其触发操作处理的帐号的唯一标识符。

    如需访问 BuiltInUserInputActiontriggeraction 方法,请使用此表单提交请求。

  6. 您的应用会显示从 MerchantSupport 服务返回的确认消息。

    • 如果服务返回状态为 INVALID_ARGUMENT 的验证错误,则会包含详细信息以及应向商家显示的本地化错误消息。建议在受影响的输入字段附近显示此类错误。下面是一个示例响应示例:
    {
      "error":
        {
          "code": 400,
          "message": "[actionInput.inputValues] Invalid user input",
          "status": "INVALID_ARGUMENT",
          "details": [
          {
            "@type": "type.googleapis.com/google.rpc.ErrorInfo",
            "reason": "invalid",
            "domain": "global"
          },
          {
            "@type": "type.googleapis.com/google.rpc.BadRequest",
            "fieldViolations": [
              {
                "field": "actionInput.inputValues.input",
                "description": "The field is required"
              }
            ]
          }
        ]
      }
    }
    
    • 如果服务返回无效状态或内部错误(由 FAILED_PRECONDITIONINTERNAL 状态表示),应用应指示商家重新加载页面或稍后重试。