schema.org에서 작업은 구조화된 데이터에서 실행할 수 있는 활동을 나타냅니다. Gmail은 여러 유형의 작업을 지원하며, 각 작업을 유사한 구조화된 데이터로 정의할 수 있습니다.
이동 작업
schema.org 항목을 사용하여 콘텐츠에 마크업을 추가하는 경우 해당 항목에 이동 작업을 추가할 수 있습니다. 예를 들어 EmailMessage 항목에 ViewAction 이동 링크를 제공하려면 다음 예와 같이 이메일의 potentialAction 속성을 채웁니다.
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "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>
이메일의 스키마를 지원하지 않는 다른 이메일 클라이언트는 이 마크업을 자동으로 무시합니다.
모바일 딥 링크
바로가기 작업은 Android 및 iOS의 모바일 앱에 있는 콘텐츠로 직접 연결될 수도 있습니다.
앱으로 딥 링크하려면 다음 예와 같이 android-app:// 및 ios-app:// 스키마로 인코딩된 target URL을 추가로 포함합니다.
JSON-LD
"target": [
"<web url>",
"android-app://<android package name>/<scheme>/<host>/<path+query>",
"ios-app://<App store ID>/<scheme>/<host><path+query>"
]
마이크로데이터
<link itemprop="target" href="<web url>"/>
<link itemprop="target" href="android-app://<android package name>/<scheme>/<host>/<path+query>"/>
<link itemprop="target" href="ios-app://<App store ID>/<scheme>/<host>/<path+query>"/>
이전 EmailMessage 예시를 확장하면 다음과 같습니다.
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"name": "Watch movie",
... information about the movie ...
"potentialAction": {
"@type": "ViewAction",
"target": [
"https://watch-movies.com/watch?movieId=abc123",
"android-app://com.watchmovies.app/http/watch-movies.com/watch?movieId=abc123",
"ios-app://12345/movieapp/watch-movies.com/watch?movieId=abc123"
]
}
}
</script>
마이크로데이터
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="name" content="Watch movie"/>
... information about the movie ...
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
<meta itemprop="target" content="https://watch-movies.com/watch?movieId=abc123"/>
<meta itemprop="target" content="android-app://com.watchmovies.android/http/watch-movies.com/watch?movieId=abc123"/>
<meta itemprop="target" content="ios-app://12345/movieapp/watch-movies.com/watch?movieId=abc123"/>
</div>
</div>
사용자에게 앱이 없는 경우 작업은 사용자를 제공된 웹 URL로 안내합니다.
인앱 액션
Gmail은 사용자를 다른 웹사이트로 보내지 않고 인앱 작업을 처리합니다. 이동 작업과 같은 인앱 작업을 선언하지만 이메일 클라이언트 (예: Gmail)가 인라인으로 작업을 처리하는 데 도움이 되는 추가 정보를 포함합니다.
target로 작업을 선언하는 대신 적절한 구성으로 작업에 HttpActionHandler를 선언합니다.
예를 들어 사용자 승인, 확인 또는 인정을 요구하는 이메일에 확인 버튼을 추가할 수 있습니다. 사용자가 버튼을 클릭하면 Google에서 서비스에 HTTP 요청을 보내 확인을 기록합니다. 사용자는 ConfirmAction와 한 번만 상호작용할 수 있습니다.
다음 예에서는 비용 보고서에 관한 이메일에 ConfirmAction 버튼을 추가합니다.
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ConfirmAction",
"name": "Approve Expense",
"handler": {
"@type": "HttpActionHandler",
"url": "https://myexpenses.com/approve?expenseId=abc123"
}
},
"description": "Approval request for John's $10.13 expense for office supplies"
}
</script>
마이크로데이터
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Approve Expense"/>
<div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="https://myexpenses.com/approve?expenseId=abc123"/>
</div>
</div>
<meta itemprop="description" content="Approval request for John's $10.13 expense for office supplies"/>
</div>
만료되는 작업
대부분의 경우 작업은 제한된 기간 동안만 관련이 있습니다. 여행 예약과 같이 날짜가 알려진 항목과 관련된 작업은 자동으로 만료됩니다. 여행이 끝난 후에는 Gmail에 작업이 표시되지 않습니다.
작업에 만료를 명시적으로 추가할 수도 있습니다. 예를 들어 쿠폰을 클립하거나 혜택 코드를 저장하는 작업은 제한된 시간 동안만 유효할 수 있습니다. 작업이 표시되는 기간을 설정하려면 작업의 startTime 및 endTime 속성을 설정합니다.
JSON-LD
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ConfirmAction",
"name": "Save coupon",
"handler": {
"@type": "HttpActionHandler",
"url": "https://my-coupons.com/approve?couponId=abc123"
},
"startTime": "2015-06-01T12:00:00Z",
"endTime": "2015-06-05T12:00:00Z"
}
}
</script>
마이크로데이터
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Save coupon"/>
<div itemprop="handler" itemscope itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url" href="https://my-coupons.com/approve?couponId=abc123"/>
</div>
<meta itemprop="startTime" content="2015-06-01T12:00:00Z" />
<meta itemprop="endTime" content="2015-06-05T12:00:00Z" />
</div>
</div>
추가 자료
작업에 대한 자세한 내용은 다음을 참고하세요.