I'm pulling the total number of reviews from an API and I wanted to show in a Schema.org itemprop="ratingCount"
.
Here's the API link: https://api.shopperapproved.com/aggregates/reviews/8149?token=m1n2JbxYqkDM7WNXhPdj&xml=false
HTML:
<div>Rating stars based on <span id="ttlreviews" itemprop="ratingCount"></span> ratings and reviews</div>
JavaScript:
<script>
$.getJSON('https://api.shopperapproved.com/aggregates/reviews/8149?token=m1n2JbxYqkDM7WNXhPdj&xml=false', function(data) {
document.getElementById("ttlreviews").innerHTML = data.total_reviews;
});
</script>
The page is showing the correct value. However, the Structured Data Testing Tool isn't catching the value ( https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fsazua.apleu.servertrust.com ).
The Structured Data Testing Tool (SDTT) isn't very good at JavaScript.
I suggest you use the Google Search Consoles URL Inspection Tool. Do a live test and copy the html it gives you into the SDTT. You will then see what Googlebot sees.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.