Article average rating

Collect simple, anonymous feedback from visitors using an intuitive 1-5 star rating system. Use the feedback to improve your content or display the average rating to build trust and social proof.

Using Shopify's native web pixel tracking and a simple HTML setup, this metafield can collect ratings from your visitors. The average rating is calculated by dividing sum of the provided ratings (a number from 1 to 5) by the number of ratings provided. The average rating is rounded to the nearest two decimal places.

The 'rating event' tracking is done by applying click event handlers to HTML elements named espresso-rating your article pages. This example uses buttons, but you can use any other HTML element that can have a name attribute, a value attribute, and supports click events, such as select, input type="radio" etc.

<button name="espresso-rating" value="1"> 1 </button>
<button name="espresso-rating" value="2"> 2 </button>
<button name="espresso-rating" value="3"> 3 </button>
<button name="espresso-rating" value="4"> 4 </button>
<button name="espresso-rating" value="5"> 5 </button>

The above will send an article rated event to our internal engine with the value of the clicked button. Espresso will then calculate the average rating and update the metafield accordingly.

If you need a different setup, let us know.

Details

  • Name
    espresso.average_rating
    Description

    Metafield namespace and key

  • Name
    number_decimal
    Description

    Metafield type

  • Name
    article
    Description

    Scope of Shopify object that owns the metafield

Example content

4.75

Was this page helpful?