---
title: "Preventing Requests to Analytics Companies"
slug: "preventing-requests-to-analytics-companies"
updated: 2023-01-06T15:49:07Z
published: 2023-01-06T15:49:07Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.catchpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Preventing Requests to Analytics Companies

There are two methods, **Request Block** and **Request Override**, to prevent HTTP requests to analytics companies. Request override tells the agent to override the URL with the URL specified in the Test Properties. Request block specifies which requests the agent should exclude. The idea is to change how a certain URL is referenced on an executed web page.

## Request Override

**Pros:** Request Override allows Catchpoint users to run “what if” scenarios without having to deploy a new version of their website or applications to test use cases like a new CDN, ad tag, etc. This method is great for tracking third-party performance and is also the preferred method, as opposed to Request Block.

**Cons**: Cannot post data to the 3rd party.

### Configuration:

1. Edit the properties of the Test, Folder, or Product.
2. In the **Requests** section, select **Override**.
3. Click on **Add HTTP Request Headers**.
4. Select **Child Host** in the **Apply To** field.
5. Input a regular expression to match specific hosts you want to override.  

- To match requests for the host `http://www.google-analytics.com/__utm.gif`, input `www\.google-analytics\.com/__utm\.gif`  

- To match a request to `http://ping.chartbeat.net/ping`, input `ping\.chartbeat\.net/ping`
6. Select **(Request Override)** in the **Field** option list.

### Format for Selenium scripts

**Request Override** can also be used in Selenium scripts for Transaction tests. The format is: `setHeader(request-override:&lt;Request_to_Match&gt;, &lt;New_String_to_Use&gt;)`

**Example:**

```
open(www.site.com)
setHeader(request-override: www.google-analytics.com/, www.site-test.com)
```

**Using `hostrequestauthority` and `hostrequestpath` macro:**

```
open(www.site.com)
setHeader(request-override: www.google-analytics.com/, ${hostrequestauthority}${hostrequestpath} )
```

## Request Block

**Pros:** The agent will not execute the blocked URL at all. The user may block a request to an analytics tag or drop the data being posted but still make the post. **Cons:** The request block may cause JavaScript errors or blank images.

### Steps to take from Test Properties:

1. Edit the properties of the Test, Folder, or Product. 2. In the **Requests** section, select **Override**. 3. Click on **Add HTTP Request Headers**. 4. Select **Child Host** in the **Apply To** field. 5. Input a regular expression to match specific hosts you want to block.

- To match requests for the host `http://www.google-analytics.com/__utm.gif`, input `www\.google-analytics\.com/__utm\.gif`
- To match a request to `http://ping.chartbeat.net/ping`, input `ping\.chartbeat\.net/ping"`  

6. Select **(Request Block)** in the **Field** option list.

### Format for Selenium Scripts

**Request Block** can also be used in Selenium scripts for Transaction tests. The format is: `setHeader("request-block","Request_to_Match")`

```
open(www.site.com)   setHeader("request-block","www\\.google-analytics\\.com/\_utm\\.gif")
```
