User Tools

Site Tools



For more details see Google Page Speed Optimizer extension page.

Guide for Google Page Speed Optimizer for Magento 2

Improve your store performance with the Google Page Speed Optimizer for Magento 2. Minify code and optimize images without quality loss.

  • Automatically reduce images size
  • Optimize your database performance
  • Minify website code structure
  • Improve your webstore pages performance
  • Raise your store score in Google PageSpeed Insights up to 99


To configure the extension, go to Stores → Configuration → Google Page Speed Optimizer.

Enable Module - set to Yes to activate the module.

The extension also works on Magento cloud.


Expand this tab to reduce HTML, CSS and JS code size. The extension removes all unnecessary line breaks, tabs, comments and spaces.

HTML Minification

Minify HTML - set the option to Yes to enable HTML minification.

When any of the settings in the field have been changed, execute the following command:
bin/magento setup:static-content:deploy


In this tab you can create an advanced bundle of JS using Advanced JS Bundling feature and JS Minification that will significantly reduce the page size in kilobytes and increase the page load speed. Google rank for both mobile and desktop will be improved.

The process of optimization is complicated. That is why it can't be performed just in one click. You have to pass 3 steps that will require specific actions from you until JS is optimized. You will need to use CLI commands to run through the optimization. Please make sure that you have access to the console and know how to do it.

Please create a full backup of your Magento instance and follow the instructions that are displayed in the Run Optimization section.

To run the optimization, set the Amasty JS Optimization option to Enabled and click Start. Easily Clear Bundle if needed.

Move JavaScript To Page Bottom option helps to load all the important content before loading JS. The functionality improves pages loading time.

This is how the bundling feature works:

If Amasty JS Optimization is Disabled, you can customize the way of code optimization. Besides Moving JS To Page Bottom, there are 3 additional options to reduce your JS code.

Merge JavaScript Files - select Yes to put all JS files into one. As a result, the number of queries will be reduced.

Enable JavaScript Bundling - enable this option to combine all JS files into few bundles and download them for each page. This helps to save time by reducing the number of server requests.

Notice that as browsers download the bundles synchronously, page rendering is blocked until all bundles finish downloading.

Minify JavaScript Files - set to Yes to enable JS minification.

Don’t forget to run the command
bin/magento setup:static-content:deploy

in the console after any changes in this block of settings have been made.


Merging CSS Files works the same way as merging JS files.

Minifying CSS Files works the same way as minifying JS and HTML.

If you set Defer Fonts Loading to Yes, the browser will load the page with system fonts and replace them with your fonts when they are loaded. It makes store pages load faster.

As in the JS tab, you can also Move Print CSS Files to Page Bottom to make your page render faster.

Flat Tables

Flat Tables allow storing all the information about a category or a product. Such tables help to shorten the query in the database. The shorter the query is, the better your store performs. Pays off for large stores with massive databases.

Other Settings

In this tab you can enable some additional settings to make your webstore perform better.

Sign Static Files - activate the option to make the browser automatically update cached values once they are changed.

Asynchronous indexing - enable to distinguish traffic patterns on the database level to avoid conflicts between read and write operations. Order data is placed in a temporary storage and moved to the Order Management grid with no accidents.

Image Optimization

Expand this tab to configure the automatic image optimization using various flexible settings. The extension allows you to optimize JPEG, PNG and GIF images.

The correct functioning of the extension requires some special software to be installed: JPEG optimization tool / PNG optimization tool / GIF optimization tool / WEBp tool. If you are not sure how to install the necessary software on the server correctly, please contact your administrator or Amasty support team.


Enable Optimize images option to compress images without quality loss and reduce web pages loading time.

Automatically Optimize Images in catalog or Wysiwyg folder - set to Yes to optimize all images uploaded to the catalog or Wysiwyg folder automatically.

Folders For Optimization - select the folders to optimize images from.

Create a new custom folder in pub/media/ if needed. You will be able to select this folder after page reload.

JPEG optimization tool - set the way to optimize JPEG images:

  • Do not Optimize - select this option to forbid optimization;
  • jpegoptim 100% quality / jpegoptim 90% quality / jpegoptim 80% quality - choose the quality level you want to get after compression. See the examples of optimized images right below the setting.

PNG optimization tool - select optipng to optimize PNG images.

GIF optimization tool - choose gifscale to compress GIF files.

Use Webp image format - set to Yes to create a copy for every image in the WebP format.

Please make sure that you have enough disc space on your server. It is also necessary to install the Webp tool package on your server using the command
 sudo apt-get install webp 

For a specific setup with versioning, use this guide.

Create Images in Smaller Resolutions - choose the type of copies to be created:

  • Mobile - the extension will create copies suitable for mobile devices. All copies will be placed in the automatically created folder - pub/media/amasty/amoptmobile.
  • Tablet - all the copies will be created specially for tablets and placed in pub/media/amasty/amopttablet folder.

Resize Algorithm - select the algorithm according to which the images will be compressed:

  • Crop - cuts pictures by size according to the device used, but not proportional to the size of the picture itself. While the height of the image would be the same, in the result the cropped image will look like the part of the original picture.
  • Resize - compresses the images in proportion to the picture itself according to the size of the field viewed. Simply it will be the same picture, but smaller in pixels.

Dump Original Images - set this option to Yes to store original images in the pub/media/amasty/amoptimizer_dump folder. It allows to collect all the original files in one place and easily update them in case the settings are changed.

Images Queue - click the Generate Queue button to form a queue based on your configuration.

You may also generate queue using the command:
php bin/magento amasty:optimizer:generate-queue
The queue is formed in the database table pref_amasty_page_speed_optimizer_queue.

Each time you click ReGenerate Queue button, a new queue is generated.

Process Images Per Request - specify the value that will indicate the number of images to optimize in a single request to the database files.

Run Optimization now - click this button to optimize selected folders images.

To run optimization manually, execute the following command:
php bin/magento amasty:optimizer:optimize
Please mind that running optimization will make an additional load to the server.

Clear Images Folder - the Clear WebP Images Folder / Clear Mobile Images Folder / Clear Tablet Images Folder buttons delete the optimized files from the pub / media / amasty / folder_name folders, depending on which button is pressed. It is used if the previously selected optimization settings were inconvenient to use and there is a need to re-generate the queue and re-optimize the images.

Lazy Load

This tab allows to choose the necessary load configuration: Simple (to configure the particular settings) or Advanced (to adjust the extended settings).


Use Lazy Loading Images - set to Yes to make off-screen images load only when a customer scrolls to them. It prevents pages full of images from lagging.

Lazy Load Script - you can choose between 2 lazy load scripts: jQuerry Lazy Script or Native JS Lazy Script. We recommend trying both of them to choose one that fits your system best.

You can decide whether to Preload Images or load them from scratch when they happen on screen. Decide how many images to load by setting Preload Images Number.

Preload Images Strategy - select the necessary algorithm:

  • WebP Format + Image Resolution - skipped from Lazy Load images will be optimized by WebP and/or Mobile and Tablet Resolutions features if they are enabled. It is a better option from the point of view of optimization and page load speed. But sometimes it can lead to some malfunctions, such as issues with swatches.
  • Original Format of Images - skipped from Lazy Load images will be loaded in the default format. No malfunctions should happen with the selected option.

Ignore Images That Contain - specify the images that should not be optimized.


All tabs of this block have the same structure as in the Simple mode, but the Advanced type is aimed at flexible customization of a specific type of site pages. Thus, you can select the most suitable type of optimization for each store page.

If the Use Lazy Loading Images option is disabled, decide whether to enable Replace With WebP and Image Resolutions setting or not:

  • Yes - to apply all optimized images in Webp format to the Lazy Loading mode.
  • No - not to replace the images.

In this case make sure that WebP and Resized images were generated priorly in the ‘Optimization’ tab.

Save the configuration.

When you’re ready with the optimization don’t forget to check your store with the Google PageSpeed Insights tool once again and compare the scores before and after optimization.

Find out how to install the Google Page Speed Optimizer via Composer

Rate the user guide
 stars  from 1 votes (Details)
magento_2/google_page_speed_optimizer.txt · Last modified: 2019/07/22 14:14 by skudrov