HTTP request and response Headers include metadata about the communication such as the referring URL, host, date, location, and more. SiteSpect's Header Triggers allow you to specify a Header to use as a matching device. SiteSpect allows you to compare the Header Triggers that you define to the Header in both the request and response.
To create a Header Trigger:
- Select Header as the type of Trigger.
Select the Header Name you want to use. Choose from among the list of common Headers. The items in the list are only suggestions. SiteSpect can match any Header present in the request or response. If the Header Name you want to use is not on the list, enter a custom name.Note: If you are creating a Trigger on the Metric page, there are several options that help further specify the Name. Select from among Contains, Starts With, Ends With, Exactly, and Regex.
- Enter the Value you want to match.
SiteSpect allows you to match using Custom Headers as well as the following common HTTP Headers:
In addition, SiteSpect allows you to match other metadata. The following choices are also available:
PROTOCOL: The protocol is HTTPS if the response is sent over SSL and HTTP if it is not.
METHOD: The method is the operation being requested. The method is usually GET when the user clicks on links; the method is POST when the user submits most HTML forms.
RESPONSE CODE: The response code is the status of the response from the web server.
- 200 OK signifies a normal successful response.
- 301 Moved Permanently signifies a permanent redirect.
- 302 Found signifies a temporary redirect respectively.
The following are a few examples of how you may want to use Header Triggers.
Set Cookie Example
To match a response in which the website sets the account cookie:
- Select the Header Trigger.
- Select Set-Cookie as the Header Name.
- Metrics only: Select a qualifier at the beginning of the Value field.
- Enter the name of the Cookie in the Value field to the right.
To match when a Header is optional, prefix the Header with a question-mark (?); the match succeeds if either the header is not present at all or it is present and the Header Value also matches.
URL and Cookie Example
To match when a visitor views the cart page (/cart.asp) without an account cookie:
- Select URL from the Triggers drop-down.
- Metrics only: Use cart.asp as the URL. Other components: Enter ^/cart\.asp as the URL.
- Add a Header Trigger.
- Metrics only: Make the Header Trigger a Cookie Trigger. Other components: Enter ^Cookie$ as the Header Name.
- Metrics only: Select Regex as the qualifier. All components: Enter ^(.(?<!\baccount=.))*$ as the Header Value.
Header Triggers allow the following matching options:
- Does not contain
- Starts with
- Does not start with
- Ends with
- Does not end with
- Does not match exactly
- Does not match regex