Cookie action

The Cookie action tells the agent to set a cookie before any script action.

This action is made up of three properties:

  • name – Name of the cookie to set.
  • value – Value of the cookie to set.
  • url – URL for the path to which to apply the cookie.

The cookie is set within any request at or below the path of this URL. For example, if you specify http://www.dynatrace.com/, the cookie will be applied to all requests to that domain.

To be a valid path, the URL must end with a slash ( / ).

This action is most frequently used to define a cookie at the beginning of a transaction, before the Navigate action; but you can use it at any point in a script. The action simulates a persistent cookie present on the system.

If the cookie modifies the behavior of the application, to see that modified behavior while recording the script you can specify the cookie using the Customize Profile functionality, that you can use to add a custom header before recording the transaction. This tells the recording browser to send the cookie along with its default headers. You can keep the cookie in the script as a header; or you clean it up after the script is recorded by removing the header and adding in a Cookie action. To remove a cookie later in the script, or to clear one previously sent by the server, specify the cookie name and URL, but leave the value empty.