前往動作會將使用者帶往可完成動作的網站。有別於單鍵動作,前往動作可以多次互動。
Gmail 中的常用動作。
應用實例
Gmail 目前支援的「移至」動作如下:
日後可能會支援更多動作。
查看動作
您可以在需要使用者前往網站完成動作的電子郵件中,加入 ViewAction
按鈕。
以下宣告會在電子郵件中新增 ViewAction
按鈕:
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"url": "https://watch-movies.com/watch?movieId=abc123",
"name": "Watch movie"
},
"description": "Watch the 'Avengers' movie online"
}
</script>
微資料
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="target" href="https://watch-movies.com/watch?movieId=abc123"/>
<meta itemprop="name" content="Watch movie"/>
</div>
<meta itemprop="description" content="Watch the 'Avengers' movie online"/>
</div>
發布商資料
您可以設定 publisher
欄位,新增寄件機構的詳細資料:
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"description": "Watch the 'Avengers' movie online",
"potentialAction": {
"@type": "ViewAction",
"url": "https://watch-movies.com/watch?movieId=abc123",
"name": "Watch movie"
},
"publisher": {
"@type": "Organization",
"name": "Google Play",
"url": "https://play.google.com",
"url/googlePlus": "https://plus.google.com/106886664866983861036"
}
}
</script>
微資料
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="Watch the 'Avengers' movie online"/>
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="target" href="https://watch-movies.com/watch?movieId=abc123"/>
<meta itemprop="name" content="Watch movie"/>
</div>
<div itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Google Play"/>
<link itemprop="url" href="https://play.google.com"/>
<link itemprop="url/googlePlus" href="https://plus.google.com/106886664866983861036"/>
</div>
</div>
追蹤動作
您可以在要求使用者前往網站追蹤包裹運送情形的電子郵件中,加入 TrackAction
按鈕。
指定 trackingUrl
屬性時,系統會自動產生動作。如要直接連結至行動應用程式,請一併加入 TrackAction
,如下所示:
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "ParcelDelivery",
"deliveryAddress": {
"@type": "PostalAddress",
"streetAddress": "24 Willie Mays Plaza",
"addressLocality": "San Francisco",
"addressRegion": "CA",
"addressCountry": "US",
"postalCode": "94107"
},
"expectedArrivalUntil": "2013-03-12T12:00:00-08:00",
"carrier": {
"@type": "Organization",
"name": "FedEx"
},
"itemShipped": {
"@type": "Product",
"name": "iPod Mini"
},
"partOfOrder": {
"@type": "Order",
"orderNumber": "176057",
"merchant": {
"@type": "Organization",
"name": "Bob Dole"
}
},
"trackingUrl": "http://fedex.com/track/1234567890"
"potentialAction": {
"@type": "TrackAction",
"target": "http://fedex.com/track/1234567890"
},
}
</script>
微資料
<div itemscope itemtype="http://schema.org/ParcelDelivery">
<div itemprop="deliveryAddress" itemscope itemtype="http://schema.org/PostalAddress">
<meta itemprop="streetAddress" content="24 Willie Mays Plaza"/>
<meta itemprop="addressLocality" content="San Francisco"/>
<meta itemprop="addressRegion" content="CA"/>
<meta itemprop="addressCountry" content="US"/>
<meta itemprop="postalCode" content="94107"/>
</div>
<meta itemprop="expectedArrivalUntil" content="2013-03-12T12:00:00-08:00"/>
<div itemprop="carrier" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="FedEx"/>
</div>
<div itemprop="itemShipped" itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="iPod Mini"/>
</div>
<div itemprop="partOfOrder" itemscope itemtype="http://schema.org/Order">
<meta itemprop="orderNumber" content="176057"/>
<div itemprop="merchant" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Bob Dole"/>
</div>
</div>
<link itemprop="trackingUrl" href="http://fedex.com/track/1234567890"/>
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/TrackAction">
<link itemprop="target" href="http://fedex.com/track/1234567890"/>
</div>
</div>
測試標記
您可以使用電子郵件標記測試工具驗證標記。貼上標記程式碼,然後按一下「驗證」按鈕以掃描內容,並接收報告中列出的所有錯誤。
規格
如要瞭解各種常用動作類型的規格,請參閱特定類型 ViewAction 或 TrackAction 的說明文件。