Magento: Getting Started

  • Updated

Welcome to Stamped! We're here to help you establish brand credibility by building trust and giving your customers a voice. Follow this guide to get set up! Be sure to visit our Stamped Resource Hub for more helpful information


In this guide


Basic Setup

Magento merchants will need to install Stamped as a custom platform. Please visit our guide here for instructions.

  1. In your Magento dashboard, go to Stores - Configuration - STAMPED.IO and complete the information referenced in the screenshot below

    Magento1.png
  2. Your Store Hash and API Keys can be found in the Stamped dashboard under Settings - API Keys
  3. You can also import the last 6 months of your order history to send reviews to recent customers

    Magento2.png

Insert Star Rating Badge in Category Pages

To add star ratings on a category page, add the following code to this file: /vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

<span class="stamped-product-reviews-badge" data-id="<?php echo $_product->getId() ?>" style="display: block;"></span>

Install Product Rich Snippets

To include product rich snippet in the Magento 2 platform, your store needs to have a set of product schema codes present in the site, which can be custom-developed or rendered by an SEO app that provides the codes, as Magento 2 does not support any structured data by default. Once the product schema is present, please install the following set of 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",
"@type": "Product",
"@id": "HTTPS://STORE.COM/URL/#product"
}


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>

You will then need to include the same "@id" field in the product schema code present within the theme file, to link the two sets of codes together:

"@id": "HTTPS://STORE.COM/URL/#product"

You can make use of Google's tool, such as GSDT to confirm the placement of the codes is correct. You should see the aggregateRating field rendering within the product schema, on product pages which contains reviews:

Magento7.png

Was this article helpful?

2 out of 2 found this helpful

Have more questions? Submit a request