Troubleshooting (Advanced) | Judge.me

Troubleshooting (Advanced)

Scrolling doesn't work in general

A click on the preview badge (usually below the product title) should scroll down to the review widget. If this doesn't work, adding a clearfix in the line before the review widget usually helps.

<div style='clear:both'></div>

Scrolling overshoots the review widget

The scrolling action can be adjusted by adding a script to offset the scrolling. This script needs to be added to the product page, e.g. templates/product.liquid. The value represents the offset in pixel.

By convention, the script is added at the end of the liquid file.

<script>
     jdgmSettings.scrollTopOffset = 160;
</script>

Stars in the review widget link to undefined product

Problem: The stars in the review widget are a link to an undefined product (e.g. collections/on-sale/products/undefined), resulting in a 404 error.

The issue is caused by a line of Javascript from the theme.

Solution: No out of the box solution. In general, filter Judge.me link (example selector: .jdgm-widget a) out of the javascript that adds this behavior.

Fix for theme.liquid with InstantClick (apply for Turbo theme)

Problem: A click on Write a review in the review widget leads to opening and closing the widget.

This bug is usually automatically taken care of by Judge.me (for all themes that have turbo in their name.

Solution: We need to tell InstantClick not to duplicate our JS file

InstantClick.on('change', function(isInitialLoad) {
  // .....
  if (isInitialLoad && script.src.includes('judge.me')) { return; }
  // .....

Example fixed code:

if (!inIframe()){
        InstantClick.on('change', function(isInitialLoad) {
          if (typeof ga == 'function') {
            ga('send', 'pageview', location.pathname + location.search);
          }

          $('head script[src*="shopify"]').each(function() {
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = $(this).attr('src');
            
            if (isInitialLoad && script.src.includes('judge.me')) { return; }

            $('body').append( script );
          });

          var facebookAnalytics = $('head .analytics').text();
          var script = document.createElement( 'script' );
          script.type = 'text/javascript';
          script.text = facebookAnalytics;
          $('body').append( script );

          $('html').removeClass('remodal-is-locked');

        });
        InstantClick.init();
      }