I am having difficulty adding Schema code into my email build - when I test the email in Gmail nothing is displaying.
I have tried testing my email and am not seeing the Schema information.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script type="application/ld+json">
[{
"#context": "http://schema.org/",
"#type": "Organization",
// WARNING: Before sending email, either point the logo
// at your own image or delete the logo annotation.
//
// If showing a logo, we recommend using an https URL.
// It's not a requirement today, but may be in the future.
"logo": "http://media.bobsdiscountfurniture.com/7843/Miscellaneous/little -bob-profile.jpg"
},{
"#context": "http://schema.org/",
"#type": "EmailMessage",
// Alternative subject line.
"subjectLine": "It's Two for Tuesday!"
},{
"#context": "http://schema.org/",
"#type": "DiscountOffer",
"description": "Two items - one great price!",
"discountCode": "",
"availabilityStarts": "2019-06-09T06:51:45-07:00",
"availabilityEnds": "2019-06-12T06:51:45-07:00"
},{
// Promotion card with single image.
// We recommend using an https URL.//
// Sample image is 538x138, 3.9 aspect ratio
"#context": "http://schema.org/",
"#type": "PromotionCard",
"image": "https://productimages.mybobs.com/20052909/20052909_hero_wide.pn g"
}]
</script>
</head>
<body>
<p>Email Body</p>
<p>Line 2</p>
</body>
</html>
I am hoping to have my Schema code display in my test email proof so that I can send to Google in order to be authorized to incorporate Schema coding into my emails on a regular basis moving forward.
You can refer to the official documentation regarding Email Markup and do a self test by sending email to yourself. Please also remember that for the content of your sample email, it is highly suggested to use a production setup same with your schema code.
Related
We are trying to integrate TrainReservation schemas in our emails, like what we did for FlightReservation before. I've tried sending a test email to myself (using google scripts) along with the following schema:
<script type="application/ld+json">
[
{
"#context": "http://schema.org",
"#type": "TrainReservation",
"reservationNumber": "175091993",
"reservationStatus": "http://schema.org/ReservationConfirmed",
"cancelReservationUrl": "https://test.com/cancel?id=AB3XY2",
"underName": {
"#type": "Person",
"name": "Test Test"
},
"reservationFor": {
"#type": "TrainTrip",
"departureStation": {
"#type": "TrainStation",
"name": "Foo"
},
"departureTime": "2021-09-21T15:15:00+04:30",
"arrivalStation": {
"#type": "TrainStation",
"name": "Bar"
},
"arrivalTime": "2021-09-21T19:55:00+04:30",
"trainNumber": "282"
},
"reservedTicket": {
"#type": "Ticket",
"underName": "Test Test",
"ticketNumber": "175091993",
"additionalTicketText": "Some text"
}
}
]
</script>
The schema is successfully tested using the markup tester. However, in the received email, I do not see any special thing, unlike FlightReservation markups that show the itinerary data at the top of the email, adds it to the calendar automatically and has action buttons for cancellation and modification.
So I'm wondering, am I doing something wrong, or is this just the normal behavior? What features do I have to expect from TrainReservation markups for the receivers of emails? (and also please answer that for BusReservation markups as well)
Appreciate this question is almost a year old, but it appeared when I Googled "TrainReservation" and "Schema" and didn't have any answers. Somebody asked it 6 years ago here, and it looks like as of August 2022 the TrainReservation type is not supported in Google Schema - you can find a list of supported schema types here, which currently only includes:
Events
Flights
Hotels
Restaurants
They haven't included car hire, but that does also seem to work in my experience.
I suppose all we can do is wait for Google to eventually implement TrainReservation and BusReservation as types. Very frustrating!
My current URL for searches is this one:
https://example.com/search/key/seach_word_here
JSON-LD
<script type='application/ld+json'>
[
{
"#context":"http:\/\/schema.org",
"#type":"WebSite",
"#id":"#website",
"url":"https://example.com",
"name":"Example",
"potentialAction":{
"#type":"SearchAction",
"target":"https:https://example.com/search/key/{search_term_string}",
"query-input":"required name=search_term_string"
}
},
{
"#context":"http:\/\/schema.org",
"#type":"Organization",
"url": "https://example.com",
"name": "Example",
"logo":"https://example.com/img/logo.png",
"#id":"#organization",
"sameAs": ["https://www.facebook.com/example"]
}
]
</script>
As you can see I'm using a friendly URL on the target.
I have seen people using a query string on the URL like this:
https://example.com/?search={search_term_string}
I did not see people using a friendly URL on the target. It's not allowed?
And at https://developers.google.com/search/docs/data-types/sitelinks-searchbox it says:
Verify your search engine implementation by copying the WebSite.potentialAction.target URL from your structured data, replacing search_term_string with a test query, and browsing to that URL in a web browser. For example, if your website is example.com, and you want to test the query "kittens", you would browse to https://www.example.com/search/?q={kittens}.
I tested this url https://example.com/search/hey/{search_word_here} and I got a 404 not found, but this URL worked: https://example.com/?p=search&tp=key&word={search_word_here}.
So my question is: Can I use a friendly URL on the target? And the code on my snippet is correct?
Of course you have to use the URL that works.
Google will use the target URL for their Sitelink Searchbox, so that users can search on Google’s SERP and end up on your internal SERP. If you specify a target URL that leads to 404 pages, having this feature makes no sense, and Google would have no interest to enable it for your results.
If that URL happens to be friendly (e.g., without a query component), so be it.
Agree with above solution from #unor, now answering about you code correction
Please check the target url in posted JSON-LD:-
"target":"https:https://example.com/search/key/{search_term_string}",
Remove the double https:
Also in case of JSON-LD: you cannot map name value to /{search_term_string}
A correct way is always like this:-
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "WebSite",
"url": "[website url]",
"potentialAction": {
"#type": "SearchAction",
"target": "[website search url]={search_term}",
"query-input": "required name=search_term"
}
}
</script>
Microdata:-
<div itemscope itemtype="http://schema.org/WebSite">
<meta itemprop="url" content="[website url]"/>
<form itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
<meta itemprop="target" content="[website search url]={search_term}"/>
<input itemprop="query-input" type="text" name="search_term">
<input type="submit">
</form>
</div>
I'm working on a multiple-language website and I'm preparing Schema.org markups using JSON-LD. Important detail: this website uses subdirectories for languages. Let's consider 2 languages:
English: https://www.example.com/
French: https://www.example.com/fr/
I want to put Corporation and WebSite things on all localized HP. Everything goes fine but for #id, url and inLanguage properties: I don't quite know what I should fill.
For Corporation, I think I got it right: I'm going to use on all pages default url and base my #id on it:
{
"#context": "http://schema.org",
"#type": "Corporation",
"#id": "https://www.example.com/#organization",
"name": "Example",
"url": "https://www.example.com/",
...
But what would be the best move for WebSite properties, on my French HP?
Technically speaking, /fr/ subfolder is part of the example.com/ domain. But then, #id, inLanguage and url are not telling my website is also available for French-speakers.
{
"#context": "http://schema.org",
"#type": "WebSite",
"#id": "https://www.example.com/#website", // should this be "https://www.example.com/fr/#website" ?
"name": "Example",
"url": "https://www.example.com/", // should this be "https://www.example.com/fr/" ?
"inLanguage": "en", // should this be "fr" ?
...
I searched a lot about this and found nothing on this particular matter.
Does anyone have any experience on this?
You have two different (albeit translated) websites. It shouldn’t matter that they share the same domain/hostname.
Each website should get its own WebSite item, with its own #id, url, and inLanguage values, while they would refer to the same Corporation item.
{
"#context": "http://schema.org",
"#type": "WebSite",
"#id": "https://www.example.com/#website",
"url": "https://www.example.com/",
"inLanguage": "en",
"publisher": {"#id": "https://www.example.com/#organization"}
}
{
"#context": "http://schema.org",
"#type": "WebSite",
"#id": "https://www.example.com/fr/#website",
"url": "https://www.example.com/fr/",
"inLanguage": "fr",
"publisher": {"#id": "https://www.example.com/#organization"}
}
If the websites are primarily translations, you could use workTranslation/translationOfWork to link the WebSite items.
"workTranslation": {"#id": "https://www.example.com/fr/#website"}
"translationOfWork": {"#id": "https://www.example.com/#website"}
(This is a good case to see why the WebSite items should have different #id values, because otherwise you couldn’t refer to their translations like that. Using the url value instead of the #id value wouldn’t be a good idea, because this URI typically represents the homepage, not the whole website.)
I'm testing actions with the Apps Script tutorial (with emails sent to myself), but currently only Go-To actions show up. This is the code I use to generate a Confirm Action, am I doing something wrong?
<script type="application/ld+json">{
"#context": "http://schema.org",
"#type": "EmailMessage",
"description": "Retry fax sending",
"action": {
"#type": "ConfirmAction",
"name": "Retry",
"handler": {
"#type": "HttpActionHandler",
"url": "http://example.com/do/ba98262b-6eb9-4314-a01a-8ff3076821e3"
"method": "POST"
}
}
}
BTW, is there any place in which we can check the status of roll-out of Gmail Actions? For instance, my Google Apps account does not show any action, while my "standard" Gmail account does.
You are simply missing a comma after the handler.url property, this is the correct markup:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "EmailMessage",
"description": "Retry fax sending",
"action": {
"#type": "ConfirmAction",
"name": "Retry",
"handler": {
"#type": "HttpActionHandler",
"url": "http://example.com/do/ba98262b-6eb9-4314-a01a-8ff3076821e3",
"method": "POST"
}
}
}
</script>
You can use the Schema Validator tool to check your markup for syntax errors like this: https://developers.google.com/gmail/schemas/testing-your-schema
Go-To and One-Click actions are launched, while Review and RSVP are not yet. Please track the Release Notes page to get all updates.
For what concerns Google Apps accounts, please note that domain admins decide which track they want to be part of and that controls when they get the new features.
I'm testing my schema button by sending to myself (I am overriding the
"From" email header address with my gmail address to test from the server that sends the email). Both recipient and sender are my gmail email address.
The schema shows up when I view the original email, but I don't see any buttons in my inbox.
Here is the script tag I am sending as part of my HTML email template:
<script type="application/ld+json">
{
"#context": "schema.org",
"#type": "EmailMessage",
"description": "User invited you to a test1.",
"action": {
"#type": "ConfirmAction",
"name": "Accept",
"handler": {
"#type": "HttpActionHandler",
"url": "http://localhost/?id=xxx"
}
}
}
</script>
Here is a screenshot of my inbox -- notice there is no "Accept" Gmail Action anywhere:
Here is a screenshot of the email itself, also not "Accept Gmail Action anywhere:
You need the sender to be your own email address and your emails to be signed with DKIM or SPF in order for Gmail to render the action. It seems like you are trying to "fake" your email address which is exactly what we need to prevent.