Rapid Reviews / Core Liquid & Scripts

Core Liquid & Scripts

Manual installation requires you to configure the core Rapid Reviews data objects and initialize the core script. Remember, if you need support just reach out and we can help.

For manual installation, you need to ensure that each page where you want to render reviews has a few things:

  1. Core scripts & liquid
  2. <div> tag for each desired widget

If you need assistance we can help:

  1. Set up an integration session and we will help you via screenshare.
  2. Add us as a developer on your theme and we will make a theme copy and integrate for you.

First Step

Paste this code anywhere on your page. Higher on the page will load a bit faster. Down by the footer will load a bit slower.

This code initializes our entire app on the client side.

It’s always a good idea to place this code in a Snippet for easy access and clean liquid code.

~CE

<script>
  // MAKE SURE WE ASSIGN THE CORRECT SHOPIFY ENTITY TYPE
  {% assign templateName = template.name %}
  {% if templateName == 'product' %}{% assign entityObject = product %}{% endif %}
  {% if templateName == 'collection' %}{% assign entityObject = collection %}{% endif %}
  {% if templateName == 'page' %}{% assign entityObject = page %}{% endif %}

  // DATA DEFINITION FROM SHOPIFY METAFIELDS
  if (!window.rapid_reviews_data) window.rapid_reviews_data = {
    data: {% if entityObject.metafields.rapid_reviews.data %}{{ entityObject.metafields.rapid_reviews.data }}{% else %}null{% endif %},
    counts: {% if entityObject.metafields.rapid_reviews.counts %}{{ entityObject.metafields.rapid_reviews.counts }}{% else %}null{% endif %},
    media: {% if entityObject.metafields.rapid_reviews.media %}{{ entityObject.metafields.rapid_reviews.media }}{% else %}null{% endif %}
  }

  // CONFIGURATION DEFINITION
  if (!window.rapid_reviews_config) window.rapid_reviews_config = {
    shop: '{{ shop.permanent_domain }}',
    entity: {
      entity_id: '{{ entityObject.id }}',
      entity_type: '{{ template.name }}'
    },
    display: {},
    routing: {}
  }

  // CORE SCRIPT - ONLY NEEDED ONCE PER PAGE
  ;(function(){
    if (window.r_u_loaded) return; window.r_u_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-core';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(rvsc, s);
  })();
</script>
HTML