<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>
This is a sample schema I copied from the example. I am using gmail html client in chrome to send HTML emails using this tag.
Why doesn't the action show up? I am sending it to my own email and I received the email. But no actions are shown.
Related
I'm trying to implement the Order schema as presented on : https://developers.google.com/gmail/markup/reference/order
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Order",
"merchant": {
"#type": "Organization",
"name": "Test Ltd."
},
"orderNumber": "56d59b633427b",
"orderStatus": "http://schema.org/PaymentComplete",
"acceptedOffer": {
"#type": "Offer",
"itemOffered": {
"#type": "Product",
"name": "Test Products"
},
"price": "41.09",
"priceCurrency": "USD",
"eligibleQuantity": {
"#type": "QuantitativeValue",
"value": "1"
},
"url": "http://project1.local/account/tickets",
"potentialAction": {
"#type": "ViewAction",
"target": "http://project1.local/account/tickets"
}
}}
</script>
The issue is that the email shows like a normal email. What am I doing wrong?
Thank you!
PS: The code validates on https://developers.google.com/structured-data/testing-tool/
Try using the JSON I've posted below. PaymentComplete is not recognized, so I used OrderDelivered. You can find more info here:
https://schema.org/OrderStatus
I noticed the word "tickets" in your URL, are you intending to use the order schema for ticket confirmations? I would suggest using event reservation instead. Using this will integrate with Google Now cards and also input the event into the user's Calendar. You can still generate a action button by using url or modifyReservationurl.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Order",
"merchant": {
"#type": "Organization",
"name": "Test Ltd."
},
"orderNumber": "56d59b633427b",
"orderStatus": "http://schema.org/OrderDelivered",
"priceCurrency": "USD",
"price": "41.00",
"acceptedOffer": {
"#type": "Offer",
"itemOffered": {
"#type": "Product",
"name": "Test Products"
},
"price": "41.00",
"priceCurrency": "USD",
"eligibleQuantity": {
"#type": "QuantitativeValue",
"value": "1"
}
},
"url": "https://project1.local/account/tickets",
"potentialAction": {
"#type": "ViewAction",
"target": "https://project1.local/account/tickets"
}
}
</script>
I'm trying to add some Schema Markup to a site built with Thymeleaf. My first thought was to use the ld+json method:
<script type="application/ld+json" th:inline="javascript">
{
"#context": "http://schema.org",
"#type": "LocalBusiness",
"address": {
"#type": "PostalAddress",
"streetAddress": /*[[ ${C:Location.street}]]*/,
"addressLocality": /*[[ ${C:Location.city}]]*/,
"addressRegion": /*[[ ${C:Location.state}]]*/,
"postalCode": /*[[ ${C:Location.zipcode}]]*/
},
}
</script>
But Thymeleaf outputs those strings in single quotes, which apparently doesn't validate as correct JSON when checking with https://developers.google.com/structured-data/testing-tool/
Is it possible to tell Thymeleaf to use double quotes here? I can do the HTML microdata markup if all else fails but I'd prefer not to since it's not as pretty and modular.
I tried to use text mode:
<script type="application/ld+json" th:inline="text">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"potentialAction": {
"#type": "ViewAction",
"url": "[[ #{${url}} ]]",
"name": "[[ #{message.button.text} ]]"
}
}
</script>
Output:
<script type=3D"application/ld+json" xml:space=3D"preserve">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"potentialAction": {
"#type": "ViewAction",
"url": "https://watch-movies.com/watch",
"name": "Watch movie"
}
}
</script>
This might be helpful for people using html.erb
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"potentialAction": {
"#type": "ViewAction",
"url": <%= resource.photos.first(3).map(&:url) %>,
"name": "some text"
}
}
</script>
Here instead of having something like ["url1", "url2", "url3"] for the url field you will get ["e;url1"e;, "e;url2"e; "e;url3"e;].
To get the desired result use .to_json.html_safe
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"potentialAction": {
"#type": "ViewAction",
"url": <%= resource.photos.first(3).map(&:url).to_json.html_safe %>,
"name": "some text"
}
}
</script>
Does Google support adding multiple markups in one email? For e.g i want to add an action button markup for Gmail and a Highlight markup for Inbox. Can this be done? I did not find any documentation for it.
Yes, having multiple markups is supported. For example, for a flight reservation.
All the code until "arrivalTime" is standard for a basic flight confirmation, but with the addition of "checkinUrl" you add a Go-To action to create a [Check In] button in Gmail.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "FlightReservation",
"reservationNumber": "RXJ34P",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Eva Green"
},
"reservationFor": {
"#type": "Flight",
"flightNumber": "110",
"airline": {
"#type": "Airline",
"name": "United",
"iataCode": "UA"
},
"departureAirport": {
"#type": "Airport",
"name": "San Francisco Airport",
"iataCode": "SFO"
},
"departureTime": "2017-03-04T20:15:00-08:00",
"arrivalAirport": {
"#type": "Airport",
"name": "John F. Kennedy International Airport",
"iataCode": "JFK"
},
"arrivalTime": "2017-03-05T06:30:00-05:00"
},
"checkinUrl": "http://united.com/onlinecheckin.html",
"potentialAction": {
"#type": "CheckInAction",
"target": "http://united.com/onlinecheckin.html"
}
}
</script>
I also do not see the button in my test emails to myself. It is in a gmail account. Does the script tag have to come directly after the body tag? The email tester https://www.google.com/webmasters/markup-tester/ says the emails good and pulls out the script tag fine.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"description": "Answer",
"action": {
"#type": "ViewAction",
"url": "testuri",
"name": "Survey"
},
"publisher": {
"#type": "Organization",
"name": "Orgname",
"url": "https://www.Orgurl",
"url/googlePlus": "https://plus.google.com/+Orgname/posts"
}
}
</script>
For testing does it matter if it is a via?
"#gmail.com via amazonses.com"
I have the correct security stuff setup per the suggested testing. I see
mailed-by: amazonses.com and
signed-by: amazonses.com
I am trying to integrate the review-action button in our review request mailers. Following is the schema used.
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"action": {
"#type": "ReviewAction",
"review": {
"#type": "Review",
"itemReviewed": {
"#type": "Product",
"name": "Samsung Galaxy Duos 06-013"
},
"reviewRating": {
"#type": "Rating",
"bestRating": "5",
"worstRating": "1"
}
},
"handler": {
"#type": "HttpActionHandler",
"url": "http://dev.snapdeal.com/reviews/rateReviewGmailButton?pageId=215768&email=furqan8810#gmail.com&limitedAccessToken=97801e79-5d2d-42c0-ad88-8e6ac06ad032",
"requiredProperty": {
"#type": "Property",
"name": "review.reviewRating.ratingValue"
},
"optionalProperty": {
"#type": "Property",
"name": "review.reviewBody"
},
"method": "http://schema.org/HttpRequestMethod/POST"
}
},
"description": "We hope you liked Samsung Galaxy Duos 06-013 . Please tell us about it."
}
</script>
The review button appears in the email . However when the publish request is sent from the button the POSTed form data is something like this:
sma=%5B%22sma%22%2Cnull%2C%22msg-f%3A1470144207624023699%22%2C1402657061725%2C%220%3Aproduct%3A%22%2C%5B%220%3Aproduct%3A%22%2Cnull%2Cnull%2C%5Bnull%2Cnull%2Cnull%2Cnull%2C%5B%22Test%22%2C4%5D%2Cnull%2C%5B%5D%5D%2Cnull%2Cnull%2Cnull%2Cnull%2Cnull%2C%5B0%2C%22product%22%5D%5D%2C%221467005e20072e93%22%2C%5B0%2C%22product%22%5D%5D&
Decoded form:
sma=["sma",null,"msg-f:1470144207624023699",1402657061725,"0:product:",["0:product:",null,null,[null,null,null,null,["Test",4],null,[]],null,null,null,null,null,[0,"product"]],"1467005e20072e93",[0,"product"]]&
The above x-www-form urlencoded data does not seem to have any pattern for us to parse/extract the "review" and "rating" data that is embedded somewhere inside this data chunk.
Could you please help me in getting the posted data read inside my Spring MVC controller.