設定服務順序

規範

如要影響特定商家的服務顯示順序,請在服務動態饋給中為各個 Service 設定 ranking_hint.score
// Ranking hints for a service.
message ServiceRankingHint {
  // Arbitrary partner or merchant assigned rank for this service.
  //
  // Services with a higher score will be shown more prominently (e.g. shown
  // higher in lists). Note that other factors may also influence ranking, such
  // as price, availability, user history, etc.
  //
  // Optional. Must be non-negative if set.
  optional float score = 1;
}
如果顯示了多項服務 (例如:直接在「書籍」按鈕之後顯示的網頁),其中有可供使用者選擇的所有服務,系統會使用「Service.ranking_hint.score」做為向「服務」排序的信號。「服務」將會在頁面上顯示分數越高。

範例

商家提供 3 種服務,分別是「剪髮」、「染髮」和「剪髮」;偏好的順序如下:
  1. 剪髮
  2. 頭皮按摩和剪髮
  3. 著色
服務動態饋給的指定方式如下:

服務

{
  "service": [
    {
      "price": {
        "currency_code": "USD",
        "price_micros": 20000000
      },
      "service_id": "haircut",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_service_name": {
        "value": "Haircut",
        "localized_value": [
          {
            "locale": "en",
            "value": "Haircut"
          }
        ]
      },
      "localized_description": {
        "value": "Get a haircut.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get a haircut."
          }
        ]
      },
      "ranking_hint": {
        "score": 30.0
      }
    },
    {
      "localized_service_name": {
        "value": "Coloring",
        "localized_value": [
          {
            "locale": "en",
            "value": "Coloring"
          }
        ]
      },
      "price": {
        "currency_code": "USD",
        "price_micros": 40000000
      },
      "service_id": "haircoloring",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_description": {
        "value": "Get your hair dyed.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get your hair dyed."
          }
        ]
      },
      "ranking_hint": {
        "score": 10.0
      }
    },
    {
      "localized_service_name": {
        "value": "Scalp massage and Haircut",
        "localized_value": [
          {
            "locale": "en",
            "value": "Scalp massage and Haircut"
          }
        ]
      },
      "price": {
        "currency_code": "USD",
        "price_micros": 30000000
      },
      "service_id": "scalpmassage",
      "prepayment_type": "NOT_SUPPORTED",
      "merchant_id": "beauty-1",
      "localized_description": {
        "value": "Get a shampoo and scalp massage followed by a haircut.",
        "localized_value": [
          {
            "locale": "en",
            "value": "Get a shampoo and scalp massage followed by a haircut."
          }
        ]
      },
      "ranking_hint": {
        "score": 20.0
      }
    }
  ]
}
指定上述排序 (不含其他信號) 會導致:

服務順序:頭髮、頭皮按摩、頭髮、著色。