Stamped Review

#27644
  • Resolved Tony
    Rank Math free

    Hello,

    i am using stamped review plugin and rank math is overwriting their review rich snippet. They say it can be solved if this code is added to rankmath. Could you do it in the next update.

    The rich snippets can be installed and integrated with Rankmath’s using the following codes:

    <script>

    function addEventListenerStamped(el, eventName, handler) {

    if (el.addEventListener) { el.addEventListener(eventName, handler); }
    else { el.attachEvent(‘on’ + eventName, function () { handler.call(el); }); }

    }

    addEventListenerStamped(document, ‘stamped:reviews:loaded’, function(e) {
    var ratingCount = jQueryStamped(‘meta[itemprop=”reviewCount”]’).attr(‘content’);
    var ratingValue = jQueryStamped(‘meta[itemprop=”ratingValue”]’).attr(‘content’);

    var richSnippet = {
    “@context”: “http://schema.org&#8221;,
    “@type”: “Product”,
    “@id”: “https://STORE.COM/URL/#product&#8221;
    }

    if (parseInt(ratingValue) > 0){
    richSnippet.aggregateRating = {
    “@type”: “AggregateRating”,
    “ratingValue”: ratingValue,
    “reviewCount”: ratingCount
    }
    }
    var script = document.createElement(‘script’);
    script.type = ‘application/ld+json’;
    script.innerHTML = JSON.stringify(richSnippet);
    document.getElementsByTagName(‘head’)[0].appendChild(script);
    });
    </script>

    Kindly note that you will need to include the property “@id” in Rankmath’s code to match Stamped.io’s schema codes, in order for the aggregateRating to register

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Tony,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I have submitted this integration issue to our developers and we will be getting back to you in a short while.
    In the meantime, you can use the following snippet on your functions.php file to block Rank Math schema & allow stamped.io to generate review schema for your products:

    /**
     * Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
     * Replace $schmea_type with schema name like article, review, etc.
     * @param bool  $value true/false Default false
     * @param array $parts Post Data
     * @param array $data  Schmea Data
     * 
     * @return bool
     */
    add_filter( "rank_math/snippet/rich_snippet_review", function( $value, $parts, $data ) {
    	return true;
    }, 10, 3 );

    Looking forward to helping you. Thank you.

    ​​​​​​​

    i already add the code, but when i checked with structured-data testing-tool on this product with reviews :https://alfasupplement.de/tru-niagen-30-kapseln
    review snippet still not working. Is that a crawling issue or issue from the code above.

    Kind regards

    Todd
    Rank Math free

    Hi Tony,

    Are you using the Stamped.io reviews on your website as well?

    The issue on your website is not really an issue, Tony.

    It is showing an error only for isRelatedTo tags that are added by the related products you show below your main product section.

    Google Structured data testing tool throws warning but it’s a false positive. In isRelatedTo field only product name and URL is required. You can check this in the new Google Rich Snippet testing tool: https://search.google.com/test/rich-results

    Still, if you want to remove the isRelatedTo then please add below filter code in his theme’s functions.php file: https://pastebin.com/aYj88Q5j

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Stamped Review’ is closed to new replies.