Rapid Reviews / Global: rating badge

Global: rating badge

The Global Reviews Badge shows the aggregate count and average rating of all reviews across your entire shop. You may choose to put this on your homepage, or some other informational page where you’d like to give your potential customers an overview of all review activity.

Add this through your Shopify admin with App Blocks.

Rapid Reviews Global Reviews Badge


Rapid Reviews Global Reviews Badge

~CE

<div class="rapid_reviews_global_reviews_badge"></div>

<!-- SMALL BADGE ADD CLASS r_small -->
<div class="rapid_reviews_global_reviews_badge r_small"></div>

<script>
  // DATA DEFINITION FROM SHOPIFY METAFIELDS
  // ONLY NEEDED ONCE PER PAGE
  window.rapid_reviews_global_data = window.rapid_reviews_global_data || {
    data: {% if shop.metafields.rapid_reviews.data %}{{ shop.metafields.rapid_reviews.data }}{% else %}null{% endif %},
    counts: {% if shop.metafields.rapid_reviews.counts %}{{ shop.metafields.rapid_reviews.counts }}{% else %}null{% endif %}
  }

  // GLOBAL WIDGET SCRIPT - DIFFERENT FROM CORE SCRIPT
  // ONLY NEEDED ONCE PER PAGE
  ;(function(){
    if (window.r_u_g_loaded) return; window.r_u_g_loaded = 1;
    var rvsc = document.createElement('script'); rvsc.type = 'text/javascript'; rvsc.async = 'true';
    rvsc.src = 'https://apps.belkapp.com/api/reviews/files/{{ shop.permanent_domain }}/rapid-reviews-global';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(rvsc, s);
  })();
</script>

<!-- 
  ADDITIONAL CONFIGURATION BELOW 
-->

<script>
  // OPTIONAL CONFIGURATION
  window.rapid_reviews_config = window.rapid_reviews_config || {}
  window.rapid_reviews_config.global = window.rapid_reviews_config.global || {}
  window.rapid_reviews_config.global.inline = true; // INLINE BADGE
  window.rapid_reviews_config.global.url_badge = 'https://example.com' // LINK BADGE TO URL
</script>

<style>
  /* OPTIONAL CSS */
  /* BADGE COLORS */
  .r_rgb {
    background-color: #fff7ea;
    border-color: #b9d3dc;
  }
</style>

<!-- 
  DIRECT METAFIELDS LIQUID ACCESS
-->
{% assign globalCount = shop.metafields.rapid_reviews.counts.value.r.counts.core.total %}
globalCount: {{ globalCount }}<br>
{% assign globalAvg = shop.metafields.rapid_reviews.counts.value.r.rating.avg %}
globalAvg: {{ globalAvg }}<br>
{% assign globalLiked = shop.metafields.rapid_reviews.counts.value.r.counts.liked %}
globalLiked: {{ globalLiked }}<br>
HTML