動作連結可讓使用者與深層連結互動,將使用者連結至合作夥伴的網站以執行動作。深層連結會顯示在商家的知識面板上。本指南將說明如何在動態饋給中加入動作連結。
你可以在以下兩個位置提供動作連結:
商家層級動作連結
當特定商家的所有服務將使用者重新導向至合作夥伴網站上的相同到達網頁時,您應透過商家動態饋給提供動作連結。
這通常只是其中一項重要的餐飲實作,因為每個商家只有一項服務。
範例如下:
- 商家提供多項服務,例如瑜珈課程、拳擊課程、單車課程、理髮、染髮、洗髮精。動作連結會重新導向至到達網頁,並顯示商家的完整服務目錄。
您必須使用商家動態饋給中 ActionLink
內含的 ActionLinkType
指定動作類型。
// 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
和商家動態饋給中的 ActionLink
中的 ActionLinkType
來指定動作類型。
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 動態饋給中的動作連結。
如要進一步瞭解如何在整合時正確加入這項資訊,請參閱下列說明文件:
- 包含此中繼資料的零售訂購動態饋給範例
- 新增及更新供應情形中繼資料的教學課程
- OrderOnlineMetadata 的參考定義