Reputation: 11
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"
}
Upvotes: 1
Views: 393
Reputation:
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.
Upvotes: 1