指定動作連結 (舊版)

動作連結可讓使用者與深層連結互動,並連往合作夥伴網站執行動作。深層連結會顯示在商家的知識面板中。本指南說明如何在動態消息中加入動作連結。

你可以在兩個地方提供動作連結:

  • 商家動態饋給 - 如果單一商家有多項服務執行類似動作,請透過商家動態饋給實作動作連結。
  • 服務動態饋給 - 如果單一商家提供多項服務,且每項服務會執行不同動作,請透過服務動態饋給導入動作連結。

如果特定商家的所有服務都會將使用者重新導向至合作夥伴網站上的相同到達網頁,請透過商家動態饋給提供動作連結。

餐飲業通常只會實作這項功能,因為每個商家只會有一項服務。

範例如下:

  • 商家提供多項服務,例如瑜珈課、拳擊課、飛輪課、剪髮、染髮、洗髮。動作連結會重新導向至到達網頁,顯示商家的完整服務目錄。

必須使用 ActionLinkType 指定動作類型,這是商家動態饋給中 ActionLink 的一部分。

  // Predetermined type of action associated with an action link.
  enum ActionLinkType {
    // The action link type is unspecified.
    ACTION_LINK_TYPE_UNSPECIFIED = 0;

    // The action link type is booking an appointment.
    ACTION_LINK_TYPE_BOOK_APPOINTMENT = 1;

    // The action link type is booking an online appointment.
    ACTION_LINK_TYPE_BOOK_ONLINE_APPOINTMENT = 2;

    // The action link type is ordering food for delivery or takeout or both.
    ACTION_LINK_TYPE_ORDER_FOOD = 3;

    // The action link type is ordering food for delivery.
    ACTION_LINK_TYPE_ORDER_FOOD_DELIVERY = 4;

    // The action link type is ordering food for takeout.
    ACTION_LINK_TYPE_ORDER_FOOD_TAKEOUT = 5;

    // The action link type is making a dining reservation.
    ACTION_LINK_TYPE_MAKE_DINING_RESERVATION = 6;

    // The action link type allows users to shop from the given merchant. It
    // could either be delivery or pickup.
    ACTION_LINK_TYPE_SHOP_ONLINE = 7;
  }

如果商家為每項服務提供不同的深層連結,或商家提供多項服務,且每項服務會執行不同的動作 (例如訂餐和餐廳訂位),則應透過服務動態饋給提供動作連結。

範例如下:

  • 餐廳提供訂位和點餐服務。一個動作連結會將使用者重新導向至餐廳訂位頁面,另一個則會將使用者重新導向至餐點訂購頁面。

動作類型可使用服務中的 ServiceType 和商家動態饋給中 ActionLinkActionLinkType 指定。

  enum ServiceType {
    SERVICE_TYPE_UNSPECIFIED = 0;

    // Service that provides dining reservation.
    SERVICE_TYPE_DINING_RESERVATION = 1;

    // Service that provides food ordering in general, could be either takeout
    // or delivery or both.
    SERVICE_TYPE_FOOD_ORDERING = 2;

    // Service that only provides food delivery.
    SERVICE_TYPE_FOOD_DELIVERY = 6;

    // Service that only provides food takeout.
    SERVICE_TYPE_FOOD_TAKEOUT = 7;

    // Services that provide event based ticketing (e.g. concerts, sporting
    // events, shows). Do not use for Reserve with Google integrations.
    SERVICE_TYPE_EVENT_TICKET = 3;
    SERVICE_TYPE_TRIP_TOUR = 4;

    // Service that provides appointments or classes. Recommended for (1) health
    // and fitness, (2) spa and beauty, and (3) financial consults and
    // evaluations services. Please see the supported service types:
    // https://developers.google.com/maps-booking/guides/end-to-end-integration/overview
    SERVICE_TYPE_APPOINTMENT = 5;

    // Service that provides appointment for an online class or session which
    // will be fully virtual. Must be set if enabling virtual service bookings.
    SERVICE_TYPE_ONLINE_APPOINTMENT = 8;

    // Service that allows users to shop from the given merchant. It could
    // either be delivery or pickup.
    SERVICE_TYPE_SHOPPING = 9;
  }

使用 OrderOnlineMetadata

OrderOnlineMetadata 用於指定要向使用者顯示的資訊,包括各種線上購物出貨方式的費用、最低訂購金額和供應情形。如果加入這項中繼資料,系統會將其連同動作連結一併納入 Merchant 動態饋給。

如要進一步瞭解如何正確地在動態饋給中加入這項資訊 (如果整合服務需要),請參閱下列說明文件: