Amasty Resolution Center

How to optimize JS with the Google Page Speed Optimizer extension?

      To optimize JS with the Google Page Speed Optimizer extension, please follow the next steps:
      1. Transfer Magento to the Production mode. It can be done with the next command from the root Magento folder:   
php bin/magento deploy:mode:set production 
      2. Navigate to Stores > Configuration > Google Page Speed Optimizer > JavaScript and enable the Amasty JS Optimization option:



      3. Save the configuration and clear the Magento cache. 
      4. Press the Run Optimization button to start JS optimization. Optimization of JavaScript includes bundling, merging, and modification: 



      5. At the beginning of the process, the extension will suggest you choose the store views for JS optimization: 



      6. Then, the extension analyses the store view and optimizes JS files. In case there are pages that the extension is unable to optimize automatically, it will request to open the pages manually: 



      Important: if you don't receive the message, but the link disappears from the popup window, it was successfully optimized, and you may close it.

      7. After successful optimization of main website pages, the extension will suggest optimizing additional pages. You can create JS bundles for your custom CMS pages and the checkout page. JS from the checkout page is not bundled by default in order not to break Magento functionality. 



      8. On the last step, the extension will list the commands to run to apply optimized JS to the website frontend. It's important to run them in the exact order they are printed:



      Now the JS optimization is finished. You can check whether JS was optimized in the Developer Console of your browser. To do so, open the console, switch to the Source tab, and check the www.website.com > static > cache/merged folder. It should contain one JS file with a similar name: 



      To complete JS optimization, enable the Move JavaScript To Page Bottom option on the module configuration page and clear the Magento cache after:



      You can check whether JS was moved to the page bottom in the Developer Console as well. Open the console, switch to the Elements tab, and search for the minified file name. When optimized successfully, the JS will be placed at the page bottom right before the closing </body> tag:



      Congratulations! You've just optimized JavaScript on your Magento with the Google Page Speed Optimizer extension. ‚Äč

      • Announcements

      • November results

              The Amasty team is already looking forward to the winter holidays, and we hope you feel this pre-Christmas vibe too! Meanwhile, let's summarize the results of November.       New features. This month was rich in new features. Let's check the most
      • October results

              The first month of Q3 is over, so let's review what the Amasty team has managed to accomplish so far.       Extension Updates. Another portion of new features was delivered by the team in October: Jet Theme       - 4-column layout display option
      • Use Cases forum announcement

        Greetings everyone! We are excited to introduce our new forum - Use Cases, where Amasty customers could share their experience of using modules on their websites. Our clients often inquire about some real websites where Amasty products are in use. We
      • Q4 roadmap

              The results of Q3 are summed up, so let’s check what new features and updates are coming next quarter. There’s a variety of interesting things!       New module features plans. Amasty always strives to deliver new functionality according to the
      • Q3 results

              September was especially productive for our team, so we will be glad to share the news from the first autumn month and sum up what has been done during the whole Q3.               Extension updates. Here is the list of new important features and