Overview
Blocking URLs is useful for excluding 3rd-party scripts such as Facebook like/share widgets, Google Analytics scripts, YouTube embeds and any other external widgets you might want to be not be part of your page load.
Conversely, Only Allow URL will ONLY serve resources from that domain.
Both support a wildcard (*) that will designate all resources that begin with the URL inputted as blocked/only allowed.
How do I Only Allow or Block URLs?
The blocked/only allowed URLs feature is located in the “Advanced Options” dropdown on the Dashboard in the “Advanced” tab, or the “Page Settings” modal on the Report page also in the “Advanced” tab.
To Only Allow a URL
This means that GTmetrix will ONLY grab resources from the URL you designated for analysis.
Example 1 – Single URL:
Inputting http://www.domain.com/foo/
will result in testing that ONLY includes resources referencing that URL. References to other URLs, even on the same domain (ie. http://www.domain.com/bam/
), are NOT included in the analysis.
Example 2 – Wildcard:
Inputting http://www.domain.com*
will result in testing that ONLY includes resources referencing that entire domain. The wildcard(*) designates that all resources that begin with the inputted URL will be only allowed(eg. http://domain.com/image.jpg
, http://domain.com/js/script.js
” will be part of the report, where as http://anotherdomain.com/image.jpg
will not be).
To block a URL
This means that GTmetrix will EXCLUDE resources from the URL you designated for analysis.
Example 1 – Single URL:
Inputting http://www.domain.com/foo/
will result in testing that excludes resources referencing that URL. All references to other URLs will still be included (eg. http://domain.com/bam/
).
Example 2 – Wildcard:
Inputting http://www.domain.com*
will result in testing that excludes all resources referencing that entire domain. The wildcard(*) designates that all resources that begin with the inputted URL will be blocked (eg. http://domain.com/image.jpg
, http://domain.com/js/script.js
” will not be part of the report)