首选操作会将用户定向至您的网站,以便他们在该网站上完成操作。与一键式操作不同,用户可以多次与快捷操作互动。
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 的文档。