Even though one of the golden rules of web performance optimization “The best request is no request” still holds true, in reality, you have to deal with a multitude of first- and third-party requests when analyzing the performance of more complex web applications.

Keeping track of all these requests and dependencies can be a challenge. You’re likely to reach a point where you wonder what a specific request does and how it affects the performance metrics that matter most to you.

Synthetic monitoring is the perfect playground for discovering how these specific requests affect the bottom line. Dynatrace Synthetic single-URL browser monitors and clickpaths now make it easy for you to block requests. This means you can start experimenting without the need to change your application.

The newly introduced request blocking option allows you to:

Block one or multiple requests.

Use the complete URL or define powerful match patterns to block a group of requests (for example, all JavaScript or image files).

How to enable request blocking

You can enable the new option Block specific requests in the Additional options section either while creating a single-URL browser monitor or clickpath (Synthetic > Create a synthetic monitor > Create a browser monitor) or while editing an existing one.

When you block requests during monitor creation, the specified URLs or patterns are already blocked when you begin recording your clickpath. These are also valid following monitor creation, during each execution of the monitor.

You can block a specific request by providing the complete URL (for example, https://example.com/thirdparty.js as shown below).

You can also define patterns, giving you an additional level of flexibility. Every request that matches the defined pattern is then blocked. For example, the generic pattern *://*/*.png (shown below) blocks all requests to PNG images. See Google Chrome’s match patterns for complete details on defining complex patterns. Matching requests are blocked throughout monitor execution and aren’t dependent on events.

Experiment and validate

Using synthetic monitors in combination with request blocking is a great and simple way to analyze how your application reacts in various scenarios. Go ahead and start optimizing your applications, but don’t forget to validate your changes with the help of Dynatrace Real User Monitoring (RUM) data.

We’ve also recently introduced another Additional option during monitor creation, the ability to set cookies for synthetic browser monitors. This option can also be set/edited at any time following monitor creation.