Judge.me integrates with many page builders so you can add our widgets easily on these pages. If you are using Shogun page builder, this will be done by inserting an HTML placeholder and placing the relevant Judge.me code.

In this article, we'll go over the steps to display Judge.me widgets on your Shogun pages.

4 steps to add Judge.me widgets in Shogun

Step 1: Add the placeholders in Shogun

  • Drag and drop an HTML element where you want to display Judge.me widget.

  • Double-click the HTML element to open the HTML text box.
  • Add a div placeholder for the widgets you want, each with a unique ID.

For the preview badge (star rating), you can use: 

<div id="judgeme_badge_placeholder"></div>

For the review widget:

<div id="judgeme_widget_placeholder"></div>

For the review carousel:

<div id="judgeme_carousel_placeholder"></div>


Step 2: Add Judge.me widget code in Shopify theme file

  • In your Shopify admin, go to Online Store > Themes > Actions > Edit code.

  • Find your layout/theme.liquid file.

If installing in theme.liquid file doesn't work, try theme.shogun.liquid or any template with the words "shogun". However, please note that these templates will get overwritten whenever there are changes made in the Shogun app.

If you want to install on a product page

If the page you want to install Judge.me widgets is a product page, you can add these widget codes inside a div with style='display:none' in the theme.liquid file above </body>.

<div style="display: none">
  {% render 'judgeme_widgets', widget_type: 'judgeme_preview_badge', jm_style: '', concierge_install: false, product: product %}
  {% render 'judgeme_widgets', widget_type: 'judgeme_review_widget', concierge_install: false, product: product %}
  {% render 'judgeme_widgets', widget_type: 'judgeme_featured_carousel', concierge_install: false %}
</div>

If you want to install on a non-product page

If the page you want to install Judge.me widgets is a non-product page (e.g. home page, reviews page,...), you'll need to manually assign a product to the preview badge and review widget by adding their product_handle to the code. 

Here's how to find the product_handle in Shopify.

<div style="display: none">
{% render 'judgeme_widgets', widget_type: 'judgeme_preview_badge', jm_style: '', concierge_install: false, product: all_products['product_handle'] %}

{% render 'judgeme_widgets', widget_type: 'judgeme_review_widget', concierge_install: false, product: all_products['product_handle'] %}

{% render 'judgeme_widgets', widget_type: 'judgeme_featured_carousel', concierge_install: false %}
</div>


In this case, only one product can be assigned to the widget, since the product variable won't dynamically change like on product pages. 

That also means that, this method can't be used to install the preview badge and review widget on a Shogun collection page.

Step 3: Add a script to load the widgets into the placeholder

Finally, a small script would need to be added below the closing </div> in Step 2. What this script does is to move the widget originally placed on the div with the display = 'none' to the placeholder in Step 1.

For the preview badge (star rating):

<script>
document.addEventListener(
'DOMContentLoaded',
function() {
document
.querySelector('#judgeme_badge_placeholder')
.appendChild(document.querySelector('.jdgm-preview-badge'));
},
false
);
</script>

For the review widget:

<script>
document.addEventListener(
'DOMContentLoaded',
function() {
document
.querySelector('#judgeme_widget_placeholder')
.appendChild(document.querySelector('#judgeme_product_reviews'));
},
false
);
</script>

For the review carousel:

<script>
document.addEventListener(
'DOMContentLoaded',
function() {
document
.querySelector('#judgeme_carousel_placeholder')
.appendChild(document.querySelector('.jdgm-carousel-wrapper'));
},
false
);
</script>

If you want to install all 3 of the widgets above, you can combine the script like this:

<script>
document.addEventListener(
'DOMContentLoaded',
function() {
document
.querySelector('#judgeme_badge_placeholder')
.appendChild(document.querySelector('.jdgm-preview-badge'));
document
.querySelector('#judgeme_widget_placeholder')
.appendChild(document.querySelector('#judgeme_product_reviews'));
document
.querySelector('#judgeme_carousel_placeholder')
.appendChild(document.querySelector('.jdgm-carousel-wrapper'));
},
false
);
</script>

Please only combine the scripts if you plan to install multiple widgets. Otherwise, the widgets cannot be loaded into the placeholder.

Advanced: If you have different templates for desktop, mobile, and tablet

With Shogun, you'll be able to design different templates for desktop, mobile, and table. In that case, with each template, you'll need to add a separate placeholder.

You can use the _tablet and _mobile suffixes to it's easier to check.

For example, after you've added the original placeholders in Step 1, you can go to your mobile template and add these placeholders:

<div id="judgeme_badge_placeholder_mobile"></div>
<div id="judgeme_widget_placeholder_mobile"></div>
<div id="judgeme_carousel_placeholder_mobile"></div>

Then, instead of the script in Step 3, add this script:

<script>
var jdgmInstaller = (function() {
var mobileMaxWidth = 767;
var tabletMaxWidth = 991;
var selectors = {
review: "#judgeme_widget_placeholder",
badge: "#judgeme_badge_placeholder",
carousel: "#judgeme_carousel_placeholder"
};

var getPlaceholders = function() {
var deviceSuffix = window.innerWidth > tabletMaxWidth ? "" : (window.innerWidth > mobileMaxWidth ? "_tablet" : "_mobile");
return {
review: document.querySelector(selectors.review + deviceSuffix) ?? document.querySelector(selectors.review),
badge: document.querySelector(selectors.badge + deviceSuffix) ?? document.querySelector(selectors.badge),
carousel: document.querySelector(selectors.carousel + deviceSuffix) ?? document.querySelector(selectors.carousel)
};
};

return {
install: function() {
var placeholders = getPlaceholders();
placeholders.review?.appendChild(document.querySelector("#judgeme_review_widget"));
placeholders.badge?.appendChild(document.querySelector("#judgeme_real_badge"));
placeholders.carousel?.appendChild(document.querySelector("#judgeme_carousel_widget"));
}
};
})();

jdgmInstaller.install();
window.addEventListener('resize', jdgmInstaller.install);
</script>

For other widgets:

The principle is the same:

  1. You'd need to add an HTML placeholder for the widget on your Shogun page
  2. You'd need to put the widget code inside a div with style="display: none" in your Shopify theme.liquid file.
  3. You'd need to add a script to move the widget in display=none to the placeholder.

You can find the liquid code for each widget in our manual installation guide.


If you have any questions or would like us to install the widgets in Shogun for you, feel free to chat with us or email our team at support@judge.me. We'll be happy to help!