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:
- Edit the properties of the Test, Folder, or Product.
- In the Requests section, select Override.
- Click on Add HTTP Request Headers.
- Select Child Host in the Apply To field.
- Input a regular expression to match specific hosts you want to override.
- To match requests for the hosthttp://www.google-analytics.com/__utm.gif, inputwww\.google-analytics\.com/__utm\.gif
- To match a request tohttp://ping.chartbeat.net/ping, inputping\.chartbeat\.net/ping - 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:<Request_to_Match>, <New_String_to_Use>)
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, inputwww\.google-analytics\.com/__utm\.gif - To match a request to
http://ping.chartbeat.net/ping, inputping\.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")