Running Yotpo with Rocket Loader (Legacy)
Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload.
Rocket Loader overwrites the original scripts with its own scripts, so instead of seeing the 'text/javascript' script as in this sample WooCommerce page:
<script type='text/javascript'>
/* <![CDATA[ */
var yotpo_settings = {"app_key":"XXX_YOUR_APPKEY_XXX"};
/* ]]> */
</script>
<script type='text/javascript' src='http://127.0.0.1/wordpress/wp-content/plugins/yotpo-social-reviews-for-woocommerce/assets/js/headerScript.js'></script>
You would see a "text/rocketscript" script tag, which looks like this:
<script type="text/rocketscript">
/* <![CDATA[ */
var yotpo_settings = {"app_key":"XXX_YOUR_APPKEY_XXX"};
/* ]]> */
</script>
<script type="text/rocketscript" data-rocketsrc="https://www.pickpals.com.au/wp-content/plugins/yotpo-social-reviews-for-woocommerce/assets/js/headerScript.js"></script>
Workaround for None-Hosted Platforms
Ask the client to login to the Cloudflare settings page and uncheck these three options (Minify JS,
Rocket Loader may disrupt Yotpo's activity on your site. Please follow the section relevant to the platform you're using in order to allow the two apps to run together:
Shopify/BigCommerce
On hosted platforms such as Shopify and BigCommerce, the easiest way to run Yotpo and Rocket Launcher together is by adding the following code to Yotpo's JavaScript:
window.onload = function() {
Add the code between the Script Tag <script type="text/javascript"> and (function e().
Finally - Clear the site cache, refresh, and ensure that everything loads smoothly.
WooCommerce
- Log into to your WooCommerce Admin.
- Navigate to Settings > WP Rocket:
- Navigate to Static Files:
- Add the following text to the Exclude JS section:
/wp-content/plugins/yotpo-social-reviews-for-woocommerce/assets/js/headerScript.js
Self-hosted platforms
Log into the Cloudflare settings page and, in the Speed tab, uncheck these three options:
- JavaScript
- CSS
- HTML