Magento 2 Speed Optimization & Advanced JS Bundling.
About the Magento 2 Speed Optimization & Advanced JS Bundling module.
The Magento 2 Speed Optimization extension significantly increases your Google Page Speed score, just by installing and configuring the module. This is achieved by implementing a series of improvements like reducing the number of server requests in an efficient way through the following optimizations:
- Magento 2 Advanced Bundling implementation
- Moving JS files to the bottom of the page
- Preloading CSS files
Magento 2 Advanced Bundling
When using default magento bundling, your site will end up with fewer requests but this process is quite inefficient because it takes all your JS files and bundle the into one big JS file that is loaded on all your pages, leading to increased page size and significantly higher loading time. What you gain by having fewer server requests, you lose by loading unnecessary JS on all your store pages.
Advanced Bundling helps you bundle the JS files in an intelligent way, by creating different types of JS bundles specific to each Magneto page. This way you benefit from the fewer requests while loading only the necessary JS specific for each page type. JS files are bundled in an efficient way, minimizing the page size and providing the speed improvements that your store needs. The Advanced Bundling process is recommended by Magento as a manually applied solution to increase speed, and this module was created to help merchants bypass the high degree of implementation complexity.
Moving JS files to page bottom
By loading your CSS files before your JS files you will be able to show the content of your page faster, and assure optimum surfing experience for the end user. First Paint Score of your page will increase significantly, and the end users will feel that your website is fast and responsive, without endless spinning wheel waiting time while browsing trough your site. Not only will site visitors have a great surfing experience but also search engines will rank your store with a higher speed score, and boost your SEO index.
Preloading CSS files
This feature will also give you an additional speed boost. Stylesheets included in the head section will be downloaded asynchronously, preventing them from blocking the page render and decreasing load times.
Here’s why page speed is a major part of a great user experience - especially for the growing population of mobile users.
- Reduce Bounce Rate - Increase Conversion Rate!
The Magento 2 Speed Optimization Extension is designed to make your web store user friendly, delivering faster page load times and increasing customer satisfaction. You’ll see a boost on Google Page Speed Insights which in turn will lead to an increase in your overall conversion rate as customers can easily navigate your site.
- SEO Optimization for a Mobile First Internet.
It’s no secret that the world of SEO is constantly changing. Since 2018 there has been a heavy focus placed on the actual user experience of a website - especially for mobile. Google’s mobile first indexing has been the gold standard, and plays a large role in your rankings. While many sites have switched to a mobile first design, your page speed optimization plays an equally important part.
The Magento 2 Speed Optimization Extension prepares your site for Google mobile first indexing and helps get you back on the front page!
Features of the Extension.
- Increases and optimizes your store's speed. Significantly higher results on Google Page Speed Insights, GT Metrics, Pingdom, Web Page Test.
- Allows for easy implementation of Magento 2 Advanced Bundling in just a few minutes.
- Reduces page size to a minimum when using advanced bundled JS files, compared to default magento bundle process.
- Reduces the number of server requests.
- Allows for JS files loading at the bottom of the page, for better first paint score.
- Allows the preloading of CSS files for even more speed.
- Easy installation and configuration.
1 MINUTE INSTALLATION GUI.
Before installing please check the extension compatibility. This extension is currently compatible with the following Magento versions 2.2.X. - 2.3.2. It is recommended to install the extension first on a testing server before you install it on a live (production) server.
Copy the extension files to below paths of your magento 2 instance. If ‘app/code/WeltPixel’ folder is missing, please create it manually:
Copy the installation GUI folder 'weltpixel-extension-installation' in the root of your Magento installation. In some Magento configurations the public root folder may be under 'pub' directory.
In your browser go to www.yourmagentostore.com/weltpixel-extension-installation/ and simply follow the installation steps from the graphical interface, presented in your browser. See the installation video: 1 Minute Module Installation via browser GUI.
Wooohooo! The extension is now installed on your Magento store! Congrats!
If you experienced any issues or limitations with this quick GUI installation, see also SSH Installation below. SSH installation does the same thing but you are required to issue the commands step by step via CLI. Some servers may have high security configurations and may limit the functionality of this GUI Installer.
How to Install via SSH.
Before installing the SpeedOptimization extension on a Magento 2 store, please check the extension compatibility. This extension is currently compatible with the following Magento versions: 2.0.X. - 2.3.2. It is recommended to install the extension on a testing server before installing it on a live (production) server.
Copy the extension files to below paths of your magento 2 instance. If ‘app/code/WeltPixel’ folder is missing, please create it manually:
Access the root of your magento 2 project from command line and run the following commands:
php bin/magento module:enable WeltPixel_Backend --clear-static-content
php bin/magento module:enable WeltPixel_SpeedOptimization --clear-static-content
php bin/magento setup:upgrade
Flush any cache that you might still have enabled on your server or in Magento.
Woohoo, the extension is installed!
How to Upgrade the extension.
- Step 1. Remove extension code under app/code/WeltPixel/SpeedOptimization before adding the new extension files. The extension may be refactored and old unused files may cause random issues so it's best to only keep the latest version of the files.
- Step 2. Follow normal installation instructions above.
Configure the Speed Optimization extension.
Magento Core Options are included in the module for visibility. Once the store is placed in Production mode, these Magento Core options are hidden, but will always be visible in this section.
- Go to Admin > WeltPixel > Speed Optimizaton > Speed Optimization Settings
Speed Optimization General Settings
- Enable - [ Yes / No ] Enable / Disable the Speed Optomization module for your store.
- Enable Advanced Bundling - [ Yes / No ] Enable / Disable the Advanced JS Bundling functionality. For best performance, it's recommended to complete the Advanced Bundling process. Instructions on how to configure Advanced Bundling can be found in the guide below.
- Merge CSS Files - Magento Core - [ Yes / No ] Enable / Disable the merging of CSS files. This is a Magento Core option. For best performance, it's recommended to set this option to Yes.
- Minify CSS Files - Magento Core - [ Yes / No ] Enable / Disable the minification of CSS files. This is a Magento Core option. For best performance, it's recommended to set this option to Yes.
- Enable CSS Preload - [ Yes / No ] Enable / Disable the preloading of CSS files. If set to Yes, stylesheets included in the head section will be downloaded asynchronously, preventing them from blocking the page render and decreasing load times. For best performance, it's recommended to set this option to Yes.
Preload all CSS Files - [ Yes / No ] Enable / Disable the preloading of all CSS files. If set to Yes, all CSS files will be preloaded, including Media Query CSS files, which are excluded if this option is set to No.
Note: If enabled, depending on server speed, there may be a flash of unstyled content, until all styles are downloaded and applied.
- Minify HTML - Magento Core - [ Yes / No ] Enable / Disable the minification of HTML. This is a Magento Core option. For best performance, it's recommended to set this option to Yes.
- The number of server requests.
- The size of those server requests.
Configuring Advanced Bundling.
These tools need to be installed on your server in order for this process to work. In case you don't know if they're installed, or you're having trouble installing them, get in touch with your hosting partner. Without these tools, while you won't be able to implement the Advanced Bundling process, you can still benefit from the other optimization settings available with the module.
Note: This applies to Debian and Ubuntu based distributions. If you need to install nodejs on other distributions, check the nodejs Package Manager installation page, or with your hosting partner.
If you have a user with sudo access, you can install nodejs using the following command:
sudo apt-get install -y nodejs
If you already have nodejs installed on the server, you can install require.js using the following command, issued from the root of your Magento installation:
npm install requirejs
If you're unable to install via this method, check the official require.js page and verify with your hosting partner.
Once Advanced Bundling is set to Yes, a box containing a series of instructions will be displayed.
- Enable Production Mode - You can do this via the command below:
bin/magento deploy:mode:set production
bin/magento setup:static-content:deploy [your_locale]
- Select Locale - All available Locales come pre-selected, however, you can choose to apply the Advanced Bundling for any number of Locales.
- Prepared Content - This step of the Advanced Bundling process lets you know that the Static Content for the selected locales has been prepared, and you're ready to move to the next step.
- SSH Commands - This step generates the necessary SSH commands that need to be run in order for the process to be completed. The commands are numbered, depending on the number of Locales that you've selected back in Step 2. The commands will need to be run in order, and you'll have to wait for each command to finish before running the next one. Once all the listed commands have been run, flush the Magento Cache from the Cache Management section. Afterwards, reload the frontend, and the Advanced Bundling should be complete!
CLI commands for deployment scripts.
If you're using deployment scripts on your Magento Instance, you can include the following command in your script, to eliminate the need of preparing the static content for the Advanced Bundling process via the Admin Section. Note: Make sure the Enable Advanced Bundling setting in Admin -> WeltPixel -> Speed Optimization Settings -> JS Optimization is set to Yes. and the config is saved.
php bin/magento weltpixel:requirejs:generate
Further Optimization for Apache Servers.
There are some additional steps that you can take in order to squeeze even more speed out of your Magento 2 store. On Apache Servers, you can edit the .htaccess file found in the root of your project by adding the following for an even greater speed boost, courtesy of the Nexcess Docs.
Static content: This will activate the Apache mod_deflate module and compress static resources into smaller files before transfer to the browser. To enable, uncomment the appropriate lines as shown below:
Attention: The following will not function on LiteSpeed servers. Browsers use Expires headers to define the lifespan of cached page components. While all page components should include Expires headers, static components and images should use far-future Expires headers. To activate this feature, uncomment the appropriate line and, directly above it, add ExpiresActive On. For example:
############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresActive On ExpiresDefault "access plus 1 year"
ETags allow browsers to validate cached page components from visit to visit. While useful, they can hamper websites hosted on server clusters in some cases. Disabling them as follows will often improve performance:
############################################ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags FileETag none
|Compatibility||Magento Open Source, Magento Commerce, Magento Commerce Cloud B2B|
|Magento version||2.2, 2.3.0, 2.3.1, 2.3.2, 2.3.3|
|Updates cost||Free lifetime updates|
|Update frequency||Monthly or each time a new Magento version is released|
|Support period||1 Month Free Support, with options to extend|
|Refund period||30 days, for any reason|
|Updated||November 27, 2019|
|Code||100% Open Source Code|
|Bundle options||For best value buy it as part of the Pearl Theme or Stack Framework|
What’s new in v.1.9.2 - Novemver 27, 2019
- Fixed an issue that caused missing transaction data in Google Analytics due to an incompatibility with the Move JS to Bottom of the Page setting within the Speed Optimization module, when the Google Tag Manager extension was configured.
- Added the possibility of preparing the Advanced Bundling process via SSH command.
- Added a build.js fallback for custom themes.
- Added Magento and PHP version in the WeltPixel Developer section.
What’s new in v.1.9.1 - October 16, 2019
- Fixed an issue whereby an error was thrown when running the Advanced Bundling while Single Store Mode was enabled.
- Fixed an error which occurred when running Swagger with the module enabled.
- Fixed an issue which caused an impossibility to agree to the Terms and Conditions on the Checkoutpage, when enabled via Magento.
- Added the possibility to exclude blocks from being moved to the bottom of the page via Admin Option.
- Confirmed compatibility with the latst Magento 2.3.3 version.
- Included the WeSupply Toolbox integration extension - Proactive Notifications Email & SMS, Returns & RMA, Store Locator, Delivery Date Estimate, Logistics Analytics, NPS & CSAT score. Get Free on-boarding and launch within 24 hours.
What’s new in v.1.9.0 - July 18, 2019
- Initial release.