How do i add Likes Received to Structured Data in JSON-LD for Product Type - schema.org

I've been trying to figure out a way to add how many likes were received to a product using structured data. Is what I have below correct? Or would the second example be more correct?
Is my usage of ["Product","InteractionCounter"] for the type correct in the first example?
I'm trying to have the google show a likes counter much like the aggregateRating property of Product.
I'm also not sure what the url in offers is supposed to point to or if it's necessary. Any ideas?
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": ["Product","InteractionCounter"],
"name": "CC-1",
"description": "Wedding Cake",
"interactionType":{
"#type":"LikeAction",
"name": "Likes",
"description": "Likes Received"
},
"interactionService": {
"#type":"WebSite",
"url": "https://example.com/index.php?page=gallery"
},
"userInteractionCount": 55
}
</script>
OR
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": "Product",
"name": "CC-1",
"description": "Wedding Cake",
"additionalProperty": {
"#type": "PropertyValue",
"name": "Likes",
"description": "Likes Received",
"value": 55
}
}
</script>
This is what I have right now:
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": ["Product","InteractionCounter"],
"name": "CC-1",
"description": "Wedding Cake with bla bla bla",
"category": "Wedding Cakes",
"brand": {
"#type": "Brand",
"logo": "https://example.com/images/logo.png",
"slogan": "Cakes Are Nice"
},
"offers": {
"#type": "Offer",
"url": "https://example.com/anvil",
"priceCurrency": "CAD",
"price": "119.99"
},
"image": "https://example.com/collection/wedding_cakes/mid_def/CC-1",
"interactionType":{
"#type":"LikeAction",
"name": "Likes",
"description": "Likes Received"
},
"interactionService": {
"#type":"WebSite",
"url": "https://mimozas.com/index.php?page=gallery"
},
"userInteractionCount": "55 PLACEHOLDER"
}

If the product is the subject of content, then it makes sense to indicate likes as part of the type Product. My suggestion for you:
{"#context":"https://schema.org",
"#type":"Product",
"name":"CC-1",
"description":"Wedding Cake",
"subjectOf":{
"#type": "InteractionCounter",
"interactionType":{
"#type":"LikeAction",
"name":"Likes",
"description":"Likes Received"
},
"interactionService":{
"#type":"WebSite",
"url":"https://example.com/index.php?page=gallery"
},
"userInteractionCount":"55"
}
}
And be careful about inverted commas.
My addition after expanding the question.
I'm trying to have the google show a likes counter much like the
aggregateRating property of Product.
Google has no direct support for the type InteractionCounter - read more Explore the search gallery. However, in the rich test results of my suggestion, there are no errors or warning messages from Google:
Probably needs experimentation.

Related

Is it possible to reference by #id without Schema.org inlining the object?

I am trying to set up Schema.org on a website, but I have trouble understanding how to use the #id attribute.
I want to specify a Corporation and a WebSite. Here is the code without a reference between the two objects:
<script type="application/ld+json">
[{
"#context": "https://schema.org",
"#id": "https://www.example.com/#corporation",
"#type": "Corporation",
"name": "Company Name",
"legalName": "Company Name",
"description": "Company Description",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo"
},
{
"#context": "https://schema.org",
"#type": "WebSite",
"name": "Example",
"url": "https://www.example.com"
}]]
</script>
The Schema.org validator finds both the Corporation and the WebSite. Google's Rich result test tool finds the logotype, as expected. Now, I want to add a reference to the Corporation as the publisher of the WebSite.
<script type="application/ld+json">
[{
"#context": "https://schema.org",
"#id": "https://www.example.com/#corporation",
"#type": "Corporation",
"name": "Company Name",
"legalName": "Company Name",
"description": "Company Description",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo"
},
{
"#context": "https://schema.org",
"#type": "WebSite",
"name": "Example",
"url": "https://www.example.com",
"publisher": {
"#id": "https://www.example.com/#corporation"
}
}]]
</script>
The Schema.org validator now only shows the WebSite and has inlined the Corporation as publisher. The Google tool does not find any objects, but I was expecting it to still find the logotype.
I have spent quite some time with the Schema.org docs and searched the internet but I can't find an explanation to this behavior.
Am I doing it the wrong way? Thanks in advance.
At the moment logo is only shown in reports if it is in a top-level Organization entity. It is still recognised internally.
Google's logic sometimes ignores embedded entities.
I found a reference from Google on this. Point 2:

How to specify more than one areaServed (eg multiple municipalities) for a LocalBusiness?

A lot of businesses serve multiple municipalities.
How should this be expressed in https://schema.org/areaServed (JSON LD)?
Eg as per https://schema.org/Service:
<script type="application/ld+json">
{
"#context": "https://schema.org/",
"#type": "Service",
"serviceType": "Weekly home cleaning",
"provider": {
"#type": "LocalBusiness",
"name": "ACME Home Cleaning"
},
"areaServed": {
"#type": "City",
"name": "New York"
},
... ?
</script>
Should it be:
"areaServed": {
"#type": "City",
"name": "New York"
},
"areaServed": {
"#type": "City",
"name": "Buffalo"
},
"areaServed": {
"#type": "City",
"name": "Syracuse"
},
Or something like:
"areaServed": {
"#type": "City",
"name": "New York",
"name": "Buffalo",
"name": "Syracuse"
},
Or something else?
According to the Schema documentation, the property areaServed can have values expected to be one of these types:
AdministrativeArea
GeoShape
Place
Text
There is no type City here as you indicate in your example. So I used type Place for my suggestion for you (alternative is the type AdministrativeArea):
{
"#context": "https://schema.org/",
"#type": "Service",
"serviceType": "Weekly home cleaning",
"provider": {
"#type": "LocalBusiness",
"name": "ACME Home Cleaning"
},
"areaServed": {
"#type": "Place",
"name":[ "New York","Buffalo"]
}
}
To use an alternative just change the name to type.
City is a "More specific Type" of "AdministrativeArea" according to schema.org documentation, so nothing wrong with using that.
(unfortunately haven't got enough points to write this as a comment under nikant25s comment but thought it was important to mention)
I would write something like this:
"areaServed": [{
"#type": "City",
"name": “New York”,
"sameAs": "https://en.wikipedia.org/wiki/New_York_City"
},
{
"#type": "City",
"name": “Buffalo”,
"sameAs": (the Wiki-page for the right Buffalo)
}],
Since there are a lot of cities with the same name it’s probably good to use the sameAs property to specify which one you mean :)

Why does Google says that an item needs an url property in schema.org?

When I put an example from the ItemList page in the Structured Data Testing Tool by Google, it says that an item needs an url property.
The example:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "ItemList",
"name": "Top 5 covers of Bob Dylan Songs",
"itemListOrder": "http://schema.org/ItemListOrderAscending",
"numberOfItems": 5,
"itemListElement": [
{
"#type": "ListItem",
"position": 5,
"item": {
"#type": "MusicRecording",
"name": "If Not For You",
"byArtist": {
"#type": "MusicGroup",
"name": "George Harrison"
}
}
}
]
}
</script>
I simplified it to have a minimal example, but the error is the same with the exact example from the page.
I tested this code and there is no error here:
{
"#type": "ListItem",
"position": 5,
"item": {
"#type": "MusicRecording",
"name": "If Not For You",
"byArtist": {
"#type": "MusicGroup",
"name": "George Harrison"
}
}
}
Can anybody explain this to me?
A ItemList in general is a list collection of sites like a breadcrumb, overview of bandsites, etc.
If you only want a list without links to deatils sites you can use only ListItem with Items. This is the different of your samples ItemList and ListItem.

ListItem Schema [schema.org/ItemList] error: "All values provided for url must have the same domain."

I am facing issue with this ListItem schema validation on https://search.google.com/structured-data/testing-tool/u/0/
Getting error
All values provided for url must have the same domain.
I have provided same domain in every URL field.
{
"#context": "http://schema.org",
"#type": "ItemList",
"name": "Tech News",
"url": "http://m.gadgetsnow.com/tech-news",
"itemListElement": [
{
"#type": "ListItem",
"position": "1",
"url": "http://m.gadgetsnow.com/tech-news/are-tvs-going-out-of-fashion/articleshow/58375579.cms",
"name": "Are TVs going out of fashion?",
"image": {
"#type": "ImageObject",
"contentUrl": "http://m.gadgetsnow.com/photo/58375579.cms",
"width": "360",
"height": "270",
"url": "http://m.gadgetsnow.com/photo/58375579.cms"
}
},
{
"#type": "ListItem",
"position": "2",
"url": "http://m.gadgetsnow.com/tech-news/reliance-jio-discounts-are-not-going-anywhere-for-now-heres-why/articleshow/58374335.cms",
"name": "Reliance Jio discounts are not going anywhere for now, here's why",
"image": {
"#type": "ImageObject",
"contentUrl": "http://m.gadgetsnow.com/photo/58374335.cms",
"width": "360",
"height": "270",
"url": "http://m.gadgetsnow.com/photo/58374335.cms"
}
}
]
}
You may try using the correct version of ItemList. There are Separately and Combined marked up ItemLists as referred here.
If your items are on the same page, please use the version with items inside, the Combined one.
Otherwise, if you point to different pages inside and your items are not on one page, please DON’T put item element with type and other
description inside, the Separately marked up one.
Additional references:
Error in Google SDTT: "All values provided for url must point to the same page."
Schema.org and ContactPoint use with validation failure: “All values provided for http://www.example.com/ must have the same domain.”
There are no bugs. Be careful if the validator gives errors, a big chance that rich snippets will not work.
So what's the problem? The first thing to note is that in the ListItem object, either url or item can be used. As the schema.org documentation says, item is used for:
an artist’s list of data artists (e.g. an 'artist' in a list of 'artists')
And the most important thing that I noticed: if you use item and you want the scheme to be correct, then the domain and its parts should be the same in all ListItem, but the anchors are different, which are separated from the url using the # symbol. Google gives a specific example:
<script type="application/ld+json">
{
"#context": "https://schema.org",
"#type": "ItemList",
"itemListElement": [
{
"#type": "ListItem",
"position": "1",
"item": {
"#context": "https://schema.org/",
"#type": "Recipe",
"url": "http://example.com/big_list_of_recipes#cherry_pie",
}
},
{
"#type": "ListItem",
"position": "2",
"item": {
"#context": "https://schema.org/",
"#type": "Recipe",
"url": "http://example.com/big_list_of_recipes#coffee_cake",
...
}
}
]
}
</script>
As you can see in the list, the same URL is used http://example.com/big_list_of_recipe, but different anchors: #cherry_pie and #coffee_cake.
But still it is not clarity how to specify the URL, which is a separate page for the thing.

Errors in Google SDTT for Schema.org Product, Offer, and PriceSpecification

I'm new with Schema.org markup, so I've actually come up with the following codes for my real estate markup, and Google testing keep saying I shouldn't use offer for priceSpecification. I'm so lost now.
{
"#context": "http://schema.org/",
"#type": "Product",
"name": "Nodorus - Precinct 17",
"image": "http://www.setiaalam.com.my/images/products/p17/nodorus-c.jpg",
"description": "A distinct modern link residence set amidst award-winning green spans, wetland wonders and multiple amenities. Come home to articulately crafted spaces where architecture and nature's beauty infuse home with fresh chic. Rejoice in this cosy new addition to Setia Alam North.",
"additionalType": "Product",
"Offer": {
"#type": "PriceSpecification",
"priceCurrency": "RM",
"priceSpecification": {
"minPrice": "593000",
"maxPrice": "890000"
},
"availability": "http://schema.org/InStock",
"seller": {
"#type": "Organization",
"name": "S P Setia"
}
}
}
If you want to add an Offer for a Product, you have to use the offers property.
So instead of this (which doesn’t make sense, because Offer is not a property):
{
"#context": "http://schema.org/",
"#type": "Product",
"Offer": {}
}
You have to use this:
{
"#context": "http://schema.org/",
"#type": "Product",
"offers": {}
}
The type of the offers value should be Offer, not PriceSpecification.
The PriceSpecification can be added to the Offer via the priceSpecification property.
So the structure could look like:
{
"#context": "http://schema.org/",
"#type": "Product",
"offers": {
"#type": "Offer",
"priceSpecification": {
"#type": "PriceSpecification"
}
}
}