Creating virtual actions in transaction scripts

Keynote’s Virtual Pages feature is implemented by creating Virtual Actions. In addition to standard actions, which are created when you record a script, you can add a virtual action to a transaction script for Application Perspective or Transaction Perspective. A virtual action is a script action that does not contain a navigation, and that contains measurement data filtered from a normally recorded action. Virtual actions can be used to track and analyze transaction data in a variety of ways. Virtual actions are reported in MyKeynote as separate transaction steps, can be used for alarms, and can be used to provide data for custom components.

An action recorded in KITE normally has two main aspects:

  • Page Navigation - navigation to the specified page.
  • Page Data - reporting the page element’s components.

A virtual action, in contrast, reports a selection of the data contained in the preceding normally-recorded action. The data reported for the virtual action is filtered according to criteria you specify. Virtual Actions can be defined by specifying page elements to match, or to exclude.

Camera Watch a 10-minute overview video about Virtual Actions.
Camera Watch a 10-minute “deep-dive” video about how to add Virtual Actions.

Virtual action examples

In the script example below, three virtual actions have been added to the script after the initial action (labeled “1. Physical Page”), which was created by recording. Each virtual action specifies rules for selecting a subset of data in the original action based on matching URL.

The virtual action labeled “4.Owned & Operated,” is defined as having elements that match the domain http://www.aol.com. All elements served by that domain are reported in the Transaction Performance Details window under Action 4.

Note that Action 4 above contains all the elements reported for Action 1, the recorded action that Action 4 is based on, but all the elements that do not match the definition for Action 4 are grayed out in the Performance Details window.

Defining matching criteria

You can match page elements based on:

  • URL - match full URL, or domain, path, or object.
  • Content-type match - match content types such as HTML, JavaScript, XML, GIF, or JPEG.
  • HTTP Referrer - match the specfic HTTP referrer.
  • Element Error - match a specific error code.
  • Is Element Cacheable - match according to the cacheability of the element.
  • Element Size - match according to the element size.

Virtual actions can be defined in multiple ways.

  • By matching a full URL, or domain, path, or object.
  • By using standard regular expression syntax to define the matching criteria. Information about regular expression syntax can be found here.
  • By combining multiple matches, joined by AND or OR.
  • You can invert the matching criteria, for example, to select all elements that DO NOT match some criteria.

Uses for virtual actions

Virtual actions have many possible uses:

  • Track and measure content from a site that is served from one or more CDNs. The data reported for the virtual action would appear in your Keynote measurements, appearing as the data for a script step.
  • Remove third-party page elements, such as ads, from page performance.
  • Remove specific types of elements, such as iframes, from the data.
  • Ignore the performance data for certain pages.

Adding a virtual action

To add a virtual action:

  1. Record an Application Perspective or Transaction Perspective script.
  2. Save and play the script.
  3. Right-click the action you want to use as the basis for the virtual action and select Insert Virtual Action.
    Insert virtual action

    A virtual action will be created and will appear in the Script Viewer.
    Virtual action in script viewer

  4. Right-click Match Page Elements and select the type of match you want to use.
    Select page match type
  5. Select the parameters for the matching type you select. See next section for details.
  6. Select the Result Processing Options for the virtual action by clicking Match Page Elements and editing the script properties if needed. These options are available:

    • Report page results to transaction (select/deselect) - this option determines whether the the data reported for the virtual action will be rolled up to the transaction level.
    • Filters logic (AND/OR) - determines whether individual match statements will be combined.
    • Report output to

      • Page results – Results of this virtual action will be reported as a page in the transaction.  (Default).
      • Custom component 1, 2, 3 - Results of virtual action will be added to one of three custom components. See this topic for more information about custom components.

Element match parameters

Each of the Page Match methods has different criteria that you can set in the Script Properties Editor.

URL Match Whole URL- if selected, match whole URL for element. If not selected, specify
Domain, Path, or Object. Filter Options:
Regular Expression - Use regex to identify element.
Case sensitive - Specify whether to consider letter case when matching.
Invert filter - Select elements that DO NOT match criteria.
Add Content-type Match Content-Type - Specify the content type as listed in the Performance Details graph. Filter Options
Regular Expression - Use regex to identify element.
Case sensitive - Specify whether to consider letter case when matching.
Invert filter - Select elements that DO NOT match criteria.
HTTP Referrer HTTP Referrer Filter Options
Regular Expression - Use regex to identify element.
Case sensitive - Specify whether to consider letter case when matching.
Invert filter - Select elements that DO NOT match criteria.
Element Error Filter Out All Errors (yes/no)
Specific Errors (if Filter Out All Errors is no, list specific errors to filter. Filter Options
Regular Expression - Use regex to identify element.
Case sensitive - Specify whether to consider letter case when matching.
Invert filter - Select elements that DO NOT match criteria.
Is Element Cacheable Cacheable (select or deselect) - Match elements based on their cacheability as determined by KITE.
Element Size Element size (Equal to, Greater than, or Less than)
Target size - zero (0) or specify file size.